Skip to content

Commit

Permalink
init.c: Declare loop variables in the loop
Browse files Browse the repository at this point in the history
  • Loading branch information
JuantAldea authored and egzumer committed Dec 28, 2023
1 parent e5cff16 commit ea73311
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions init.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/

#include <stdint.h>
#include <string.h>

extern uint32_t __bss_start__[];
extern uint32_t __bss_end__[];
Expand All @@ -29,18 +30,18 @@ void DATA_Init(void);

void BSS_Init(void)
{
uint32_t *pBss;
for (pBss = __bss_start__; pBss < __bss_end__; pBss++)
for (uint32_t *pBss = __bss_start__; pBss < __bss_end__; pBss++) {
*pBss = 0;
}
}

void DATA_Init(void)
{
volatile uint32_t *pDataRam = (volatile uint32_t *)sram_data_start;
volatile uint32_t *pDataFlash = (volatile uint32_t *)flash_data_start;
uint32_t Size = (uint32_t)sram_data_end - (uint32_t)sram_data_start;
unsigned int i;

for (i = 0; i < (Size / 4); i++)
for (unsigned int i = 0; i < (Size / 4); i++) {
*pDataRam++ = *pDataFlash++;
}
}

0 comments on commit ea73311

Please sign in to comment.