X-Git-Url: https://hackdaworld.org/gitweb/?a=blobdiff_plain;f=betty%2Fstartup.s;h=fb42ac7deecf00f97af2e2bf7053221bb53675b6;hb=6292cc9190f6e7f36a3634057740e770d58d7460;hp=d6b0184641a3d02d4af553c485ad929a4f80e42e;hpb=ac35214abd7d42a7294047d1c8b7ce7552a38fbf;p=my-code%2Farm.git diff --git a/betty/startup.s b/betty/startup.s index d6b0184..fb42ac7 100644 --- a/betty/startup.s +++ b/betty/startup.s @@ -102,12 +102,15 @@ handle_reset: ldr r0, =stack_limit mov sl, r0 - # copy data section + # copy data section (only if we are in flash <=> _etext != _data) ldr r1, =_etext ldr r2, =_data ldr r3, =_edata + cmp r1, r2 + beq start_of_c_code + copy_data_loop: cmp r2, r3 @@ -117,6 +120,8 @@ copy_data_loop: # jump to c code +start_of_c_code: + adr lr, loop_forever mov r0, #0 mov r1, #0