0

Circuitpython without uf2 bootloader?
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Circuitpython without uf2 bootloader?

by criznach_bms on Mon Apr 19, 2021 12:51 pm

Is it possible to run circuitpython on a SAMD21 board like the m0 express without the uf2 bootloader? I'm finding that it takes around 5 seconds for code to start running on my board, and I need it to handle a power-on button press. Currently it isn't going to work. I even switched a gpio pin on in the board_init() function and recompiled, and strangely that pin gets toggled on and off several times during boot. Does board_init() get called multiple times?

criznach_bms
 
Posts: 8
Joined: Fri Mar 09, 2018 12:33 pm

Re: Circuitpython without uf2 bootloader?

by tannewt on Mon Apr 19, 2021 2:16 pm

What do you mean by power on button press? We do generally start on power up slowly in case the power dips soon after.

tannewt
 
Posts: 2491
Joined: Thu Oct 06, 2016 8:48 pm

Re: Circuitpython without uf2 bootloader?

by criznach_bms on Mon Apr 19, 2021 2:34 pm

I have a feather m0 express, with an external power button connected to an external power supply's enable pin. Once code starts running I set a GPIO high to latch the power supply on after the button is released. So this only works if the code executes before the button is released. If you can point me to where that delay happens, I can experiment with a custom build. If I have to modify the bootloader, I might as well just not use it, because I won't be flashing new firmware once it leaves my bench.

criznach_bms
 
Posts: 8
Joined: Fri Mar 09, 2018 12:33 pm

Re: Circuitpython without uf2 bootloader?

by tannewt on Mon Apr 19, 2021 4:29 pm

Here are two delays in CP I know of:
https://github.com/adafruit/circuitpyth ... ain.c#L478
https://github.com/adafruit/circuitpyth ... mode.c#L81

And one in UF2:
https://github.com/adafruit/uf2-samdx1/ ... ain.c#L129

The last two are used to make second taps of reset do something. You can run a custom circuitpython without a bootloader by changing the linker script to place CP at the start of flash.

tannewt
 
Posts: 2491
Joined: Thu Oct 06, 2016 8:48 pm

Re: Circuitpython without uf2 bootloader?

by criznach_bms on Mon Apr 19, 2021 6:04 pm

Thank you! I'll look into running without UF2.

criznach_bms
 
Posts: 8
Joined: Fri Mar 09, 2018 12:33 pm

Please be positive and constructive with your questions and comments.