Skip to content

Commit

Permalink
boot/startup: Fix .bss and .data initialization
Browse files Browse the repository at this point in the history
Wrong condition was used for bss clearing loop and
for .data copying loop.

First 4 bytes of each region was not copied/zeroed.

Now condition is >= instead of >

Signed-off-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>
  • Loading branch information
kasjer committed Mar 5, 2024
1 parent a2ee892 commit a5b74b3
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
14 changes: 7 additions & 7 deletions boot/startup/src/arch/cortex_m33/cortex_m33_startup.s
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ Reset_Handler:

.L_copy_loop:
subs r2, #4
ittt gt
ldrgt r0, [r1, r2]
strgt r0, [r3, r2]
bgt .L_copy_loop
ittt ge
ldrge r0, [r1, r2]
strge r0, [r3, r2]
bge .L_copy_loop

b .L_for_each_copy_region

Expand All @@ -63,9 +63,9 @@ Reset_Handler:

.L_zero_loop:
subs r2, #4
itt gt
strgt r0, [r1, r2]
bgt .L_zero_loop
itt ge
strge r0, [r1, r2]
bge .L_zero_loop

b .L_for_each_zero_region
.L_zero_table_done:
Expand Down
14 changes: 7 additions & 7 deletions boot/startup/src/arch/cortex_m4/cortex_m4_startup.s
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ Reset_Handler:

.L_copy_loop:
subs r2, #4
ittt gt
ldrgt r0, [r1, r2]
strgt r0, [r3, r2]
bgt .L_copy_loop
ittt ge
ldrge r0, [r1, r2]
strge r0, [r3, r2]
bge .L_copy_loop

b .L_for_each_copy_region

Expand All @@ -60,9 +60,9 @@ Reset_Handler:

.L_zero_loop:
subs r2, #4
itt gt
strgt r0, [r1, r2]
bgt .L_zero_loop
itt ge
strge r0, [r1, r2]
bge .L_zero_loop

b .L_for_each_zero_region
.L_zero_table_done:
Expand Down
14 changes: 7 additions & 7 deletions boot/startup/src/arch/cortex_m7/cortex_m7_startup.s
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ Reset_Handler:

.L_copy_loop:
subs r2, #4
ittt gt
ldrgt r0, [r1, r2]
strgt r0, [r3, r2]
bgt .L_copy_loop
ittt ge
ldrge r0, [r1, r2]
strge r0, [r3, r2]
bge .L_copy_loop

b .L_for_each_copy_region

Expand All @@ -60,9 +60,9 @@ Reset_Handler:

.L_zero_loop:
subs r2, #4
itt gt
strgt r0, [r1, r2]
bgt .L_zero_loop
itt ge
strge r0, [r1, r2]
bge .L_zero_loop

b .L_for_each_zero_region
.L_zero_table_done:
Expand Down

0 comments on commit a5b74b3

Please sign in to comment.