Go Down

Topic: Running a sketch without bootloader (Read 805 times) previous topic - next topic

pjrebordao

I have a finished sketch that I would like to load and run "naked" on a Nano 33 BLE without bootlader.
The purpose is to make it start faster without the delay that the bootloader always imposes while listening for a connection.

For that I bought a cheap CMSIS-DAP programmer from Alex Taradov and made the 5-pin connector for the SWD pins on the underside of the Nano.

I made sure that the whole thing worked together by burning sucessfully the bootloader using the SWD pins.

Now I want to upload my compiled sketch into the Nano, overwriting the existing bootloader. How to do it ?


Juraj

#1
Sep 16, 2020, 07:12 pm Last Edit: Sep 16, 2020, 07:17 pm by Juraj
did you try "Upload with programmer" in menu?

if it works it will not delete the bootloader. for that you have to create a custom variant with a different linker script putting the binary together to address 0.
 
https://arduino.stackexchange.com/questions/54484/adding-a-custom-board-to-the-arduino-ide/60660#60660

in my_boards I have a M0 variant without bootloader

pjrebordao

Oops... I didn't see that option
I tried it and it worked but of course the bootloader is still there.

To set up my own variant can I grab the board definition from somewhere within the arduino installation?

Juraj

Oops... I didn't see that option
I tried it and it worked but of course the bootloader is still there.

To set up my own variant can I grab the board definition from somewhere within the arduino installation?

it is
.arduino15/packages/arduino/hardware/mbed/1.1.6/variants/ARDUINO_NANO33BLE/
and
.arduino15/packages/arduino/hardware/mbed/1.1.6/boards.txt

location of the arduino15 folder is the location of the preferences file you can see in Preferences dialog in IDE.

simple option is to copy the folder to other name and copy the boards settings in boars.txt for modified boards settings

but this will be lost at package update so better is to create your variant in your hardware folder in the 'my_boards' way

pjrebordao

Me again...

Ok, I created the variant structure inside my sketch:
C:\Users\pjr\Google Drive\wf_meter\wf_meter_v2\hardware\my_boards\nrf52\variants\ARDUINO_NANO33BLE

Now, I suppose I have to change the location where the sketch will be loaded ?

Is it -DMBED_APP_START inside ldflags.txt ?

Juraj

#5
Sep 17, 2020, 11:39 am Last Edit: Sep 17, 2020, 11:39 am by Juraj
Me again...

Ok, I created the variant structure inside my sketch:
C:\Users\pjr\Google Drive\wf_meter\wf_meter_v2\hardware\my_boards\nrf52\variants\ARDUINO_NANO33BLE

Now, I suppose I have to change the location where the sketch will be loaded ?

Is it -DMBED_APP_START inside ldflags.txt ?
the location should be the hardware folder in the sketchbook folder. the sketchbook folder is configured in Preferences.

for M0 I changed in .ld
FLASH (rx) : ORIGIN = 0x00000000+0x4000, LENGTH = 0x00040000-0x4000
to
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00040000

so I guess you should change something in linker_script.ld


pjrebordao

Ok and should I do something to force the usage of the hardware folder inside the sketch ?

Juraj

Ok and should I do something to force the usage of the hardware folder inside the sketch ?

it is not possible

pjrebordao

So it will be used by default the next time I do an upload ?

Juraj

So it will be used by default the next time I do an upload ?

to apply changes in boards definitions the IDE must be restarted

pjrebordao

Done everything. The sketch was indeed uploaded through CMSIS-DAP, but the bootloader is still there.

The board is still recognized by the IDE when I plug the USB port and the sketch still takes the same time to start.

What could be wrong ?

Juraj

Done everything. The sketch was indeed uploaded through CMSIS-DAP, but the bootloader is still there.

The board is still recognized by the IDE when I plug the USB port and the sketch still takes the same time to start.

What could be wrong ?

is it possible to upload over serial? the USB is there because the sketch has it

pjrebordao

Indeed, while the port appears visible, I'm unable to upload the sketch over USB anymore.
However, the sketch still takes the same time as before to start running.

Juraj

Indeed, while the port appears visible, I'm unable to upload the sketch over USB anymore.
However, the sketch still takes the same time as before to start running.

mbed RTOS boot?

pjrebordao


Go Up