Page 1 of 1

Linking bootloader and firmware

Posted: Mon Sep 21, 2015 6:37 pm
by Mantas
Hello guys,

I have problem with my bootloader and firmware, so here it goes. I've written a bootloader code which downloads new encrypted firmware via RS-485 conected to USART1 using XMODEM-CRC protocol, and AES-EAX decryption and authentication algorithm, and with flash patritioning. So basically it all works well with bootloader, it downloads new firware (performs CRC checks while doing it), decrypts it, checks authenticity, verifies that the firmware is genuine and copies it from buffer partition to the main one and jumps to the starting address of the firmware. I compile and link my bootloader with it's exception vectors sitting at the begining of the flash which is remaped (mirrored) to start at 0x0. So far so good (all works well), and I can verify the written memory content manually, and all looks exactly like unencrypted application in the binary viewer. I link the application to start at address just after bootloader, 0x108000 (or 0x008000), download it and jump to this address, and then application should copy its exception vectors to RAM, perform a repam so that RAM would be mirrored at 0x0. But after the jump the application carries out a couple of instructions in dissassembly and goes into abort exception. And I can't understand why this is happening....when I compile and download the application normally it works does ARM bootloader do this, and how is flowcode compiling the applications? is it necessary to include assembly startup file for the ARM chip in firmware application? I think low level initialization is not mandatory as the processor is up and running...what about Cstack? IRQ stack? do i need new initialization for them in firmware? or do I need just to compile the bare application without any initializations and startup files? Is it possible to change flowcode linking address for the applications? Or is it permanently hardwritten in the software to be 0x002000?

Thanks alot for any help, because I've been bussy with this application for a couple of months now and I know I'm very close to getting it work, but just need to make this final push :mrgreen:


Re: Linking bootloader and firmware

Posted: Wed Sep 23, 2015 5:38 pm
by Mantas
I found out how to edit the linking address...but the other questions still remain...still waiting for a reply, and/or suggestions on bootloader/firmware starting codes and linking.