Skip to content

Commit

Permalink
Data/bss section initialization fix (#492)
Browse files Browse the repository at this point in the history
Makes data/bss initialization support sections with length not a multiple of 4-bytes. Previously such a binary caused an infinite loop or hard fault upon boot.
  • Loading branch information
balazsracz authored Dec 23, 2020
1 parent 1f8f205 commit 96d5ab8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions boards/armv7m/default_handlers.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ void reset_handler(void)
unsigned long *dst = (unsigned long *)*section_table_addr++;
unsigned long len = (unsigned long)*section_table_addr++;

for (; len; len -= 4)
for (; len > 0; len -= 4)
{
*dst++ = *src++;
}
Expand All @@ -102,7 +102,7 @@ void reset_handler(void)
unsigned long *zero = (unsigned long *)*section_table_addr++;
unsigned long len = (unsigned long)*section_table_addr++;

for (; len; len -= 4)
for (; len > 0; len -= 4)
{
*zero++ = 0;
}
Expand Down

0 comments on commit 96d5ab8

Please sign in to comment.