cancel
Showing results for 
Search instead for 
Did you mean: 

Secondary bootloader

Mateusz Grosik
Associate II
Posted on March 03, 2017 at 23:31

Hello

I try make a secondary bootloader. I must send my code program from stm32f103 board to SPC560P board via CAN, and program should downlaod by BAM to flash.

I used transceivers. I know i should make user.ld, but can you explain me how?

I make some standalone_ram.ld in ghs, here is my file, it is correct to ran uC in BAM mode?

MEMORY {

// 384k Internal Flash

flash_rsvd1 : ORIGIN = 0x00000000, LENGTH = 8

flash_memory : ORIGIN = ., LENGTH = 384K-8

flash_rsvd2 : ORIGIN = ., LENGTH = 0

// 24KB of internal SRAM starting at 0x40000000

dram_rsvd1 : ORIGIN = 0x40000000, LENGTH = 0

dram_reset : ORIGIN = ., LENGTH = 0

dram_memory : ORIGIN = ., LENGTH = 24K-256

heap_reserve:origin = ., LENGTH = 8K

stack_reserve:origin = ., LENGTH = 8K

dram_rsvd2 : ORIGIN = ., LENGTH = 16

}

DEFAULTS {

stack_reserve = 4K

heap_reserve = 4K

}

//

// Program layout for running out of RAM.

//

//

SECTIONS

{

.PPC.EMB.sdata0 ABS : > dram_memory

.PPC.EMB.sbss0 CLEAR ABS : > .

.text : > dram_memory

.vletext : > .

.syscall : > .

.rchw NOCHECKSUM : > .

.secinfo : > .

.rodata : > .

.sdata2 : > .

.fixaddr : > .

.fixtype : > .

.sdabase ALIGN(16) : > dram_memory

.sdata : > .

.sbss : > .

.data : > .

.bss : > .

.heap ALIGN(16) PAD(heap_reserve) : > .

.stack ALIGN(16) PAD(stack_reserve) : > .

//

// These special symbols mark the bounds of RAM and ROM memory.

// They are used by the MULTI debugger.

//

__ghs_ramstart = MEMADDR(dram_rsvd1);

__ghs_ramend = MEMENDADDR(dram_memory);

__ghs_romstart = MEMADDR(flash_rsvd1);

__ghs_romend = MEMENDADDR(flash_rsvd2);

_ram_image_heap = ENDADDR (heap_reserve);

_ram_image_stack = ENDADDR (stack_reserve);

_ram_image_end = ENDADDR (.bss);

}

Best regards

Mateusz

This discussion has been locked for participation. If you have a question, please start a new topic in order to ask your question
11 REPLIES 11
procolo
Senior
Posted on March 20, 2017 at 15:10

Hello,

I'm working on a test application allowing to get code from can and program it to flash. I will come back asap.

My Idea is to run a boot-loader which will receive code via CAN , flash code to a given address and set the boot to another flash address so at next boot , board will run this code. Does this match your requirements?

question:

is the following request related to the same problem ?:

https://community.st.com/0D50X00009XkYZ5SAN

Mateusz Grosik
Associate II
Posted on March 22, 2017 at 14:27

Yes, sounds good. I should sending a binary code from STM32F103 to SPC560 using CAN. And SPC560 using BAM have to program a flash. SPC560 board have a transceiver and it received binary image. I will be grateful for your help.

Best regards.

Mateusz Raczkowski

Posted on March 22, 2017 at 14:28

And now i trying do it on SPC560P disp board

procolo
Senior
Posted on March 24, 2017 at 16:35

Hi,

Attached application for Discovery Pictus is a SW BAM.

it receives data from CAN bus (speed 300khz) , load to RAM and the jump

this app is tested using spc5connect with spc5 flasher.

You can start fromhere, implementing the same protocol on your STM32 and the modify the BAM to write in flash instead of RAM (if needed) using the flash component.

Please be sure to use the latest version of spc5Studio (5.2.3)

Regards,

Procolo

________________

Attachments :

SPC560Pxx_SW_BAM.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Hyks&d=%2Fa%2F0X0000000bC1%2FvRQdu3AEIuMqLPs.4oltDPa7Zc4u5nVPqcdFWL1UZ44&asPdf=false
Mateusz Grosik
Associate II
Posted on March 24, 2017 at 19:52

Thanks a lot, i have one more question. When i useing CAN bus, i need to set a password?

Something like this in chapter 5.2: 

http://www.st.com/content/ccc/resource/technical/document/reference_manual/cf/ad/d5/76/55/1f/49/de/CD00192452.pdf/files/CD00192452.pdf/jcr:content/translations/en.CD00192452.pdf

  

In here i see password: 0xFEED_FACE_CAFE_BEEF

I can change this using external app? 

Regard

Mateusz

Posted on March 27, 2017 at 08:57

Yes of course,

you can implement your own StartPasswordCheck(uint64_t *passwordptr ) function.

This code implements BAM via SW but you can modify it as per you needs.

Regards,

Procolo

Mateusz Grosik
Associate II
Posted on March 27, 2017 at 11:38

Thanks, and when i use BAM and CAN i should set jumper like this: ABS0=0, ABS2=1, FAB=1?

And when i program spc560 i should receives via CAN using pins CANH and CANL. Do i think right?

Regards and thanks for your time

Mateusz

Posted on March 28, 2017 at 08:18

ABS0=01 ABS2=0, FAB=1

Regard,

Procolo

procolo
Senior
Posted on March 29, 2017 at 13:41

Hi,

Let me attach two applications.

1) it' s the BAM emulated via SW (i've solved some bugs) . it's also able to receive program from SPCCONNECT, load in ram and jump to the application

2) its a loader . It's able to send a bin file to the first application using CAN bus. the file to load (in this example is the serial test app for pictus complied with LOAD in RAM option ) is created using a free tool calledbin2header. it generate a file out_bin.h which should be put in source folder of the project.

I think this is a good starting point for your bootloader application.

Procolo

________________

Attachments :

Bootloader.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Hyck&d=%2Fa%2F0X0000000bBo%2FubPzeAGOaOZ_YhalXCJmDDyAXOmoGMkAdFYJDrRr7CQ&asPdf=false