summaryrefslogtreecommitdiffstats
path: root/setup.c
diff options
context:
space:
mode:
Diffstat (limited to 'setup.c')
-rw-r--r--setup.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/setup.c b/setup.c
index 9cb0312..cb83eb4 100644
--- a/setup.c
+++ b/setup.c
@@ -31,8 +31,10 @@ void setup(void)
UNSET_BIT(WDOG_STCTRLH, STCTRLH_WDOGEN);
/* Copy data and clear bss */
- memcpy(_sdata, _ldata, _edata - _sdata);
- memset(_sbss, 0, _ebss - _sbss);
+ for (size_t i = 0; i < (size_t)(_edata - _sdata); i++)
+ _sdata[i] = _ldata[i];
+ for (size_t i = 0; i < (size_t)(_ebss - _sbss); i++)
+ _sbss[i] = 0;
/* Enable port clocks */
SIM_SCGC5 |= BV(SCGC5_PORTE) | BV(SCGC5_PORTD) | BV(SCGC5_PORTC)