TrackNet / bootloader

Update-capable Bootloader
MIT License
5 stars 4 forks source link

How to modify current project FW for match the bootloader #1

Open donnick138 opened 6 years ago

donnick138 commented 6 years ago

Hi I'm load the bootloader on the memory's top, then compiler my current project with 4 bytes header for CRC and Length and fill 0xFF and the END for fit multiple 256 bytes. And load the application firmware to the 0x3000 memory address then restart, but there is nothing happened, seems the bootloader is not working, but load the Hello application firmware back, it work fine.Question is i don't know how to debug by using gcc environment, i'm using keil or sw4stm32 IDE. And how to modify the entrypoint of application firmware on keil or sw4stm32 IDE environment?

Nick

mkuyper commented 6 years ago

Hi Nick

You need to make sure that your application is linked such that it can be loaded at 0x08003000. The easiest way to do that is to configure your tool to use 0x08003000 as the beginning of Flash. That way, it will leave the first 12K -- which are currently reserved for the bootloader -- alone.

The application firmware should have a header of 3 words (12 bytes): https://github.com/TrackNet/bootloader/blob/afae98e9425d2202d6260827d2619f4ea0172bd4/example/stm32l0/hello.c#L21-L28

You should use fwtool.py to patch the CRC and size to the correct value after build. The third word is the pointer to your entry point function. The bootloader will jump to that address upon startup.

Mike

donnick138 commented 6 years ago

Hi Mike OK, because I using extra tool to add header for firmware binary file and I missing the third word is point of my entry point. For now, it seems need add the 3 words header on my current firmware, but I don't know how to add this header by using Keil IDE. The .ld file is not support for Keil.

donnick138 commented 6 years ago

Hi Mike I found the Lora-mac project is turn to using VScode to develop, it seems like also using gcc base and support .ld file, so I should using VScode to develop? But I need porting the project to VScode first.

Nick

donnick138 commented 6 years ago

If I want to using https://github.com/Lora-net/LoRaMac-node as application FW, what should I do?