CAN Boot Strap Loader and Memory doubts.

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
User8282
Level 1
Level 1
Good morning.

I am implementing a CAN BSL procedure for the XMC4500 microcontroller. I have downloaded the Application note and the sample programs.

I have developed a host PC application that communicates with the hexagon starter kit. I can send the CANLoader program to PSRAM and it runs. Then I can communicate from the host PC application to the CANLoader in PSRAM:

CANLoader sends ACK: CAN_BSL_EXECUTION
Host sends CMD: FLASH ERASE COMMAND
CANLoader sends ACK: FLASH_ERASE_EXECUTION
Host sends CMD: FLASH_PROGRMA_COMMAND
Host sends an AppSW: 64 pages, 32 sectors each one. CANLoader sends an ACK after writing each page.
At the end, CANLoader sends ACK: FLASH_PROGRAM_EXECUTION

By last, host program sends “Start the new AppSW in slave” (0xC1), and CANLoader sends ACK (0x1F). But nothing happens. After a Power Reset, nothing happens neither.

I can see two reasons for this: either the AppSW is not correct (1) or it is not stored at the proper location (2).

(1): To generate the AppSW, I configure the Output file format as “binary”. Is this correct? I suppose it is, as I am doing the same with the CANLoader application and it works. The documentation says "A flash image file" has to be sent. Is this the way to get a Flash Image file?

(2): Relating the location, the sample AppSW comes with two “.ld” files. One seems to map the program at 0x0C000000 and the other one at 0x0C020000. The CANLoader sample program has two different functions: one to run the downloaded program (at 0x0C020000), and a different one to run the Flash program (at 0x0C000000). I do not understand the purpose of loading the program at 0x0C020000. If I am right, after a Power Reset in Normal Boot Mode the code at 0x0C000000 will be executed. Is that right? Anyway, I have tried loading the program at both locations and the result is the same.


Thanks in advance for your help.
Jose Luis.
0 Likes
1 Reply
Travis
Employee
Employee
First solution authored Welcome! 500 replies posted
(1): To generate the AppSW, I configure the Output file format as “binary”. Is this correct? I suppose it is, as I am doing the same with the CANLoader application and it works. The documentation says "A flash image file" has to be sent. Is this the way to get a Flash Image file?

I assume that your host PC is taking the role of the Host application it. If this is true, then binary format for your case is correct. For the example, the Application Software: XMC4400_AppSW is mapped to flash location 0C020000. Thus you can checked if your binary data is the same as the data found in the flash location 0C020000.


1215.attach

(2): Relating the location, the sample AppSW comes with two “.ld” files. One seems to map the program at 0x0C000000 and the other one at 0x0C020000.

The application software should be mapped in C020000.


The CANLoader sample program has two different functions: one to run the downloaded program (at 0x0C020000), and a different one to run the Flash program (at 0x0C000000). I do not understand the purpose of loading the program at 0x0C020000.

The CANLoader software shall be requested by the Slave, once both parties (Host n Slave) has established the correct baud rate and communication. The CANLoader is used by the slave to receive CAN data (which is the XMC4400_AppSW) and flash program it into the designated memory location C020000. And after flash programming is completed, it shall performed a reset to start the application program.

If I am right, after a Power Reset in Normal Boot Mode the code at 0x0C000000 will be executed. Is that right? Anyway, I have tried loading the program at both locations and the result is the same.

After power reset in normal boot mode, the slave should run the application code which is in C020000




case START_APPSW_COMMAND:
{
SendAck(MAIN_APP_EXECUTION, 0);
while (CAN_MO1->MOCTR & 0x00000100); // wait until the hast been transmited)
RunDownloadedCode(); // Run flash code in Flash_iCache (downloaded Application code at 0x0C04,0000)
}


////////////////////////////////////////////////////////////
// void RunDownloadedCode(void):
// - Run code at 0x0C02,0000 (downloaded application code)
////////////////////////////////////////////////////////////
void RunDownloadedCode(void)
{
__asm(
"ldr r0, =0x0C020000\n"
"ldr r1, =0xE000ED08\n" //VTOR register
"str r0,[r1]\n"
"ldr sp, [r0], #4\n"
"ldr r15, [R0]"
);

}

0 Likes