cancel
Showing results for 
Search instead for 
Did you mean: 

Compiling programs that will be bootloaded

cleanser23
Associate II
Posted on January 15, 2015 at 18:53

These forums are great, thanks in advance for all your help!

I'm using an STM32F439, no IDE has been picked yet, but either Keil or IAR

My application involves swappable FLASH (or EEPROM) boards that contain the program running.  I am going to write a bootloader (many examples here) to do that by reprogramming the flash at address 0x8000 C000.

I know that in the application which is bootstrapped I need to move the NVIC table.

My question is, when I compile this program, do I simply edit the linker script to tell it it starts at location C000 instead of 0?

Also, how do I get this compiled binary on the cartridge?  Can I plug the cartridge in (to the memory map), modify the linker in a similar way (starting program location vs execute location), program it, and remove the flash cart?

Thank you so much

#stm32f #flash #bootloader
7 REPLIES 7
Posted on January 15, 2015 at 20:54

Executing from external memory will be VERY slow.

You should build for 0x0800C000 rather than 0xC000, less likely to be issues with shadowing if you build/run at the memory's native address. You'd reprogram SCB->VTOR with the base address of the vector table. In ST's Standard Peripheral Library this typically gets done in SystemInit(), and is often overlooked when people modify the scatter file or linker script.

Suggest you review the IAP examples, including how the Discovery Upgrade example which pulls a firmware image from a USB Flash Stick.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
cleanser23
Associate II
Posted on January 15, 2015 at 21:56

Thanks, you're right the physical hardware address is much better.

I understand I change the vector table offset register, but I'm not certain I know what you mean by 

scb->vtor

I'll look at those examples, thanks!

Posted on January 15, 2015 at 22:44

Googling scb->vtor

http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dai0321a/BIHHDGBC.html

Cause it's in the SCB not the NVIC...

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
cleanser23
Associate II
Posted on January 15, 2015 at 23:17

Thanks, clive1

I guess my googling skills are a little off today XD

I appreciate you taking the time to help me out.

The last thing I need to be able to do before I am 100% confident is program the external NOR flash with the program to be booted.  

I know this can be done similarly to IAP except writing to the external NOR flash after setting up the FMC and writing to it, however it would make my life MUCH easier if I could use the jtag to do it, perhaps there is some sort of tool that already exists to save me having to write this?

I have been googling for an hour or so, so it could be I don't know the right terminology.

Thanks a bunch

Posted on January 16, 2015 at 01:09

Segger has there J-Flash application. For CFI compatible memory devices you need to configure the memory interface to the point it can recognize the NOR/NAND device from it's MFG ID, etc. As I recall it uses scripting to program the CPU/Peripherals.

In Keil you create and load flash applets for specific memory regions by selecting them in the ''Algorithm'' option in the Options->Debug Setting->Flash configuration.

The applets load as small code routines that are JTAG'd and run from flash, and configure the processor, clocks, pins, external buses and memory devices.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
cleanser23
Associate II
Posted on January 16, 2015 at 10:48

Thanks very much