cancel
Showing results for 
Search instead for 
Did you mean: 

Newbe to stm32, need to write a bootloader for CAN

sima
Associate II
Posted on January 21, 2010 at 03:20

Newbe to stm32, need to write a bootloader for CAN

28 REPLIES 28
sima
Associate II
Posted on May 17, 2011 at 13:05

Hello all experts

I'm using the Ride7 IDE together with a REva STM32 starter kit.

I have experimented with CAN and other peripherals and now I feel confident about their functions. So the finale would be to write a boot loader for my application.

What do I need to read to be able to write a CAN boot loader for the STM32?

Are there any examples available?

pandoraems
Associate II
Posted on May 17, 2011 at 13:05

I wrote a bootloader that checks SD card and loads new firmware if available on SD

It was pretty easy, all you need is to start from the simplest bootloader example for stm32 and just go from there and add simple CAN high level protocol to load up the firmware. Then just burn the received firmware page by page into flash and jump into the beginning of the newly loaded firmware once done

sima
Associate II
Posted on May 17, 2011 at 13:05

Do you have a link to that example?

sima
Associate II
Posted on May 17, 2011 at 13:05

I found AN2557. And I think it includes what i need. :D

If I understand it correctly it uses a linker file “stm32f10x_hd_flash_offset.ld� to select where in FLASH the application should end up (0x8002000).

If I look in the linker file, it says:

/* include the memory spaces definitions sub-script */

/*

Linker subscript for STM32F10x definitions with 512K Flash and 64K RAM */

/* Memory Spaces Definitions */

MEMORY

{

RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 64K

FLASH (rx) : ORIGIN = 0x8002000, LENGTH = 512K-0x2000

FLASHB1 (rx) : ORIGIN = 0x00000000, LENGTH = 0

EXTMEMB0 (rx) : ORIGIN = 0x00000000, LENGTH = 0

EXTMEMB1 (rx) : ORIGIN = 0x00000000, LENGTH = 0

EXTMEMB2 (rx) : ORIGIN = 0x00000000, LENGTH = 0

EXTMEMB3 (rx) : ORIGIN = 0x00000000, LENGTH = 0

}

/* higher address of the user mode stack */

_estack = 0x20010000;

I don’t have 512K FLASH nor 64K RAM in my STM32 device. Should I edit this file to meet the specifications of the STM32 I’m using?

pandoraems
Associate II
Posted on May 17, 2011 at 13:05

yes, all these memory sizes/offsets in the linker file should be in line with the device you're using

good luck

szymon_stroba
Associate II
Posted on May 17, 2011 at 13:05

Hi everyone!

Sima1 I have the same problem,I also need to write CAN bootloader for STM32. At the moment I`m in the begining of the project and I wonder if You`ve done the job already? I would be very greatful for Your help.

st3
Associate II
Posted on May 17, 2011 at 13:05

You have 2 essentially separate & distinct parts to this problem:

1. Transferring the data: For this part, it is irrelevant that the data happens to be a firmware image - so you can treat this part as just a standard data transfer task.

2. Programming the flash, and running the program: For this part, it is irrelevant how the data was transferred - so you can just adopt the process outlined in the Application Note already mentioned.

szymon_stroba
Associate II
Posted on May 17, 2011 at 13:05

But I have to transfer the bootloader to SRAM and run it again, and this part seems to be complicated. Should I do it in assembler or can I do it in C??

I`m using codesourcery gcc + openOCD + Eclipse.

[ This message was edited by: szymon_stroba on 30-10-2009 07:05 ]

szymon_stroba
Associate II
Posted on May 17, 2011 at 13:05

Yes, I actually have. And there is no mention that I should put my bootloader in SRAM in the first place, so I will reprogram Flash starting from 0x08002000 while reading from flash 0x08000000 - 0x08002000 and then just jump to user application. I hope that will work.

[ This message was edited by: szymon_stroba on 03-11-2009 07:43 ]