BAM application not start MPC56xxF

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

BAM application not start MPC56xxF

2,809 Views
Nicolas_Forge
Contributor II

Hi all.
I wrote a test application. I am sending this application via CAN Bus, but the application does not start.
What I'm doing wrong?
Just I have to modify the Linker Files?

if I removed these links in __start.c then the application works !
bl __init_registers
bl __init_hardware
bl __init_data
bl __init_user

Installed Products:
- CodeWarrior for MCU
Version: 11.1
Build Id:181224

Thank you very much for your time!

Tags (1)
0 Kudos
Reply
7 Replies

2,763 Views
Nicolas_Forge
Contributor II

Thank you so much Lukas!
you can show me an example of filling the section ?
in file RAM.lcf need add addresses ?

0 Kudos
Reply

2,742 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

you can simply use this code where I’m using addresses from your linker file:

start of internal RAM = 0x40004400

size of internal RAM + heap + stack = 0x40030000 - 0x40004400 = 0x2BC00

 

/* MPC5674F L2SRAM initialization code                         */

    lis r11, 0x40004400@h /* Base address of the L2SRAM, 64-bit word aligned */

    ori r11,r11, 0x40004400@l

 

    li r12,1400  /* Loop counter to get all of L2SRAM; 0x2BC00/4 bytes/32 GPRs = 1400 */

    mtctr r12

 

    init_l2sram_loop:

        stmw r0,0(r11)        /* Write all 32 GPRs to L2SRAM */

        addi r11,r11,128      /* Inc the ram ptr; 32 GPRs * 4 bytes = 128 */

        bdnz init_l2sram_loop /* Loop for 256k of L2SRAM */

 

    blr

 

Or you can deliver the numbers from the linker file like:

_internal_ram_addr = ADDR(internal_ram);

And then use “extern” in the C file.

 

Regards,

Lukas

2,708 Views
Nicolas_Forge
Contributor II

HI
Thank you so much !
i removed this code from initialization))
I don’t know why this code doesn’t work,
i wrote different code for the compiler S32DS and CW
for CW the code works, but for S32DS the same code does not work, can you look and tell me what is the reason?
why does the application not work on S32DS?
maybe the S32DS needs to change the start code?
I changed the start code to CodeWarrior and it works! maybe it's not right?


CodeWarrior i changed StartUp
asm void __start(register int argc, register char **argv, register char **envp)
{
nofralloc /* MWERKS: explicitly no stack */
/* frame allocation */

mr r14, argc
mr r15, argv
mr r16, envp

mr r3, r14
mr r4, r15
mr r5, r16
bl main

0 Kudos
Reply

2,684 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

I'm little bit confused by this description. Could you please explain once more what is working, what is not working, what you removed?

Thanks,

Lukas

0 Kudos
Reply

2,778 Views
Nicolas_Forge
Contributor II

Hi  
yes i read it, but i didn't find an error))

0 Kudos
Reply

2,767 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Well, I guess it will be related to RAM initialization. If you use FLASH target, this code is executed in INIT_Derivative function in MPC5674F_HWInit.c:

#if defined(ROM_VERSION) && (ROM_VERSION == 1)

/* SRAM initialization code*/
lis r11,L2SRAM_LOCATION@h
ori r11,r11,L2SRAM_LOCATION@l

/* Loops to cover L2SRAM, stmw allows 128 bytes (32 GPRS x 4 bytes) writes */
lis r12,L2SRAM_CNT@h
ori r12,r12,L2SRAM_CNT@l
mtctr r12

init_l2sram_loop:
stmw r0, 0(r11) /* Write 32 GPRs to SRAM*/
addi r11,r11,128 /* Inc the ram ptr; 32 GPRs * 4 bytes = 128B */
bdnz init_l2sram_loop /* Loop for L2SRAM_CNT times */

#endif

But because you use RAM target to build the image, it cannot be called because it would overwrite itself.

When BAM loads the image via serial interface, each write of BAM initializes the RAM. But this initializes only the image area, not rest of the RAM.

There are two options:

1. You can enlarge your image with dummy data, so the BAM will initialize also rest of the RAM. This can be recommended only for very small amount of RAM, otherwise the loading of image will take a lot of time.

2. Better option is to use the code above and adjust the addresses to simply init the rest of the RAM at the beginning.

Regards,

Lukas

 

0 Kudos
Reply

2,782 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

take a look at this thread where I described all steps to build an image which can be loaded by BAM:

https://community.nxp.com/t5/Other-NXP-Products/Boot-Assist-Module-BAM-with-FlexCAN-MPC5604P/m-p/263...

Have you followed all those steps?

Regards,

Lukas

0 Kudos
Reply