Hi all!
I'm trying to write a bootloader application for SAM7X which receives a new (encrypted) firmware via the debug port, stores it in external flash, and after successfully downloading/storing it copies/decrypts the firmware to internal flash of the SAM7X. So far the bootloader and firmware(application) have been contained in a single µVision project and it seemed I can update the firmware. Bootloader and application have been put in two different ROM regions and when I wanted to download a new firmware I just skipped the bootloader part in the HEX file. But when I added the encryption stuff which also uses some library code I ran into troubles (code shared by bootloader and application) so I split the bootloader and application in two different projects. The project for the bootloader should be straight forward: include the ASM startup code, link code to ROM section 1, put all variables in RAM section 1. After running the bootloader call the firmware's 'main' function which is to be placed on a known address (beginning of the ROM section 2) via a function pointer.
What I'm not sure about is how to set-up the project for the application? I configured µVision to put code in ROM section 2, and variables in RAM section 2. But I did NOT add the ASM startup code since this was already included in the bootloader. When I compile the application I get a linker Warning: .\V4R0.sct: Warning: L6305W: Image does not have an entry point. (Not specified or not set due to multiple choices.) Not sure if this is a problem since the build process completes. However when I want to execute the firmware it seems that calling the application's 'main' (name is different since there can only be one main()), BUT then enters the ABORT mode at some point. I doubt it's got something to do with the application since this has been already running (without the bootloader).
Anybody got any idea? I'd really appreciate! regards, Chris
I just added the following line (MSR...) to the beginning of the startup code putting the microcontroller in system mode
; Reset Handler EXPORT Reset_Handler Reset_Handler MSR CPSR_c, #Mode_SYS:OR:I_Bit:OR:F_Bit
but it still fails to execute the application.
I'm wondering if it's possible to read back the content of the internal flash and compare it against a binary/hex file using ULINK2? some background: when I download the application firstly I do a CRC check, write to external flash and compare (ie read back) the data, and finally do a MD5 over the whole (application) code. Only if this succeeds I update the internal flash with the new firmware. Before splitting bootloader and application in two projects updating the internal Flash was already working. But since I don't trust my own code anymore I'd like to verify the content of the Flash using ULINK2 (it's the only programmer I've got), but from µVision it's only possible to either 'Erase' or 'Program' the chip. It seems there's no executeable for the ULINK2 just DLLs?
Christoph, I'm new to the bootloader scene and I was wondering if you might be able to share parts of your bootloader project with me. At this point I'd be happy to just have the project basics: *.uvproj, *.uvmpw, <startup>.s, *.sct, and maybe some source code. I'm at: henleaze@cableone.net
Help! -chas-