Skip to content

Commit 4f128a7

Browse files
committed
DM: fix worst bug in entire world
1 parent e8b4580 commit 4f128a7

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

cores/arduino/startup.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050

5151
void SystemInit( void )
5252
{
53+
5354
//***************** SAMD51 ************************//
5455
#if defined(__SAMD51__)
5556
NVMCTRL->CTRLA.reg |= NVMCTRL_CTRLA_RWS(0);
@@ -97,6 +98,10 @@ void SystemInit( void )
9798
* 4) Enable DFLL48M clock
9899
*/
99100

101+
while ( GCLK->SYNCBUSY.reg & GCLK_SYNCBUSY_GENCTRL0 ){
102+
/* Wait for synchronization */
103+
}
104+
100105
/* DFLL Configuration in Open Loop mode */
101106

102107
OSCCTRL->DFLLCTRLA.reg = 0;
@@ -203,6 +208,8 @@ void SystemInit( void )
203208
/*---------------------------------------------------------------------
204209
* Set up main clock
205210
*/
211+
212+
206213
GCLK->GENCTRL[GENERIC_CLOCK_GENERATOR_MAIN].reg = GCLK_GENCTRL_SRC(MAIN_CLOCK_SOURCE) |
207214
GCLK_GENCTRL_IDC |
208215
//GCLK_GENCTRL_OE |

platform.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ compiler.warning_flags.all=-Wall -Wextra
3333

3434
compiler.path={runtime.tools.arm-none-eabi-gcc.path}/bin/
3535
compiler.c.cmd=arm-none-eabi-gcc
36-
compiler.c.flags=-mcpu={build.mcu} -mthumb -c -g -O0 {compiler.warning_flags} -std=gnu11 -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -MMD
36+
compiler.c.flags=-mcpu={build.mcu} -mthumb -c -g -Os {compiler.warning_flags} -std=gnu11 -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -MMD
3737
compiler.c.elf.cmd=arm-none-eabi-gcc
3838
compiler.c.elf.flags=-Os -Wl,--gc-sections -save-temps
3939
compiler.S.cmd=arm-none-eabi-gcc

0 commit comments

Comments
 (0)