Flash Download Fail and _init_user function fralloc issue

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

Flash Download Fail and _init_user function fralloc issue

751 Views
sandeepbs
Contributor I

Hi all,

 

We are using a ST Micro SPC564A80B4 controller with Codewarrior 2.10 compiler. However as this microcontroller is of the same family as MPC5644A we are using the startup files from Codewarrior directories. During startup phase as soon as the control enters _init_user function it tries to execute fralloc directive it fails and jumps to BAM code. Also when we try to download the elf file using debugger it gives an error "Flash Programming did not execute completely".

 

This issue gets resolved when we allocate __init_user and FlashConfig functions to .init section in __ppc_eabi_init.h as below.

extern void __init_user(void) changed to __declspec(section ".init") extern void __init_user(void)

and add

__declspec(section ".init") extern void FlashConfig(void)

 

We are NOT using VLE.

 

We are using MSL with Runtime.PPCEABI.N.a library with below compiler options.

CCOPT = -c -enum int -gdwarf-2 -codegen -cpp_exceptions off -sdatathreshold 0 -sdata2threshold 0 -fp SPFP -spe_vector -O2,p -proc Zen -ir .
ASOPT = -proc Zen -gdwarf-2
LNOPTS = -proc zen -gdwarf-2 -m __init_strtup -romaddr 1 -rambuffer 0x00043000 -romaddr 0x00043000 -sdatathreshold 0 -sdata2threshold 0 -o application.elf -map -srec application.mot -sreclength 26 -sreceol dos -nostdlib

 

Can you please let us know,

1) How to resolve this issue as we do not want to modify the standard startup files to allocate __init_user and FlashConfig functions to .init section

2) Why fralloc is used only in __init_user function and in rest all part of startup files its nofralloc?

3) Why there is no extern declaration for FlashConfig?

4) Is it mandatory to use VLE option for SPC564A micro?

Labels (1)
2 Replies

526 Views
martin_kovar
NXP Employee
NXP Employee

Hello,

I tested CodeWarrior startup with NXP MPC5644A and it works correct. I tested BookE and VLE project. Both projects worked me correct. I consulted your issue with my colleague and he told me that CodeWarrior startup has never been tested with ST microcontrollers.

1) Unfortunately, I cannot test CodeWarrior startup with SPC564A80B4, because I do not have this one.

2) Directive fralloc is used, because this assembler function needs to use stack frame. This directive says to compiler to allocate stack frame. Other functions does not need stack frame, so nofralloc directive is used.

3) There is no extern declaration, because this function is accessed directly from assembler. There is no function call  from C code.

4) No, MPC5644A works correct with BookE too.

Maybe, you could try to contact ST support and ask them about the startup. They will be available to test the startup and tell you, what is wrong. I would like to help you more, but I do not have any device I can test it with.

Regards,

Martin

0 Kudos

526 Views
sandeepbs
Contributor I

Hi Martin,

Thanks for the response.
SPC564A80B4 has got the same core e200Z4 as MPC5644A and both were developed jointly with NXP-ST collaboration as far as I understand. We are using MPC5534 in our project from past 10 years, hence we were bit familiar with NXP startup files, eTPU, Codewarrior,..etc., and as Andorra is of the same family we wanted to use a similar setup which we are familiar with.

Sure we will check with ST too, however can you please check below queries.

1) Why the __init_user function is not in .init section whereas rest all _init functions like _init_hardware,..etc., are in .init section ?
2) Is it ok to force __init_user and FlashConfig functions to go to .init section in __ppc_eabi_init.h as below or does it have any adverse effects ?

extern void __init_user(void) changed to __declspec(section ".init") extern void __init_user(void)
and add __declspec(section ".init") extern void FlashConfig(void)

0 Kudos