TC367 ADS V1.8: how to make global variables in a section not automatically initialized by iLLD?

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

cross mob
zhouyi_NJ
Level 3
Level 3
50 sign-ins 10 questions asked 10 replies posted

Hello, 

dear friend:

The background for this question is: App needs to transfer some data to bootoader, and App jump to FBL via 'soft' reset. 

Following solution works fine for NXP MCU:

1.allocate the variables to share date between App and FBL in a special section named 'NoInit_RAM'

2. In startup.s (created by compiler automatically),  bypass the copy initiliazation for section 'NoInit_RAM'

For TC367 +ADS1.8,  step 1 is completed successfully, 

variable counter_receive is allocated to section 'NoInit_RAM' and its address is 0x70020000 like below

NoInitSection.png

But I don't know how to do step 2. 

From my know-how, the ADS created file Ifx_Ssw_Tc0.c , and call function Ifx_Ssw_doCppInit() to perform variable initialization. 

/* Initialization of C runtime variables and CPP constructors and destructors */
Ifx_Ssw_doCppInit();

The function _c_init() in lib libcs_fpu.a is called to do the actual initialization, it's impossible to change logic of _c_init()

IFX_SSW_INLINE void Ifx_Ssw_C_InitInline(void)
{
extern void _c_init(void);
_c_init(); /* initialize data */
}

I guess the '__A0_MEM' is used by _c_init() to initialize the global variables,  so

The dsram0 size is changed from 192K to 128K, limited to range [0x7000000, 0x70020000]

But variable counter_receive is still initialized to value = 3

Could you please give me a solution to bypas the section 'NoInit_RAM' initialization?

the lsl and map file is attached for your reference. 

thanks and BR

Zhou Yi

 

0 Likes
1 Solution
Di_W
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 250 solutions authored

Hi ZY, please also refer to this link which is in Chinese.

View solution in original post

0 Likes
5 Replies
Di_W
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 250 solutions authored
clear / noclear [on | off | default | restore] (*)
By default, uninitialized global or static variables are cleared to zero on startup. With pragma noclear,this step is skipped. Pragma clear resumes normal behavior. This pragma applies to constant data as well as non-constant data.
See C compiler option --no-clear.

ZY, Could you please try --no-clear pragma?  The details is in um of Tasking.

0 Likes
zhouyi_NJ
Level 3
Level 3
50 sign-ins 10 questions asked 10 replies posted

the 'noclear' seems doesn't work:

I add #prgama noclear for variable counter_receive like below:

#pragma section fardata "NoInit_RAM"
#pragma noclear
uint32 counter_receive;
#pragma clear
#pragma section fardata restore

 

during the SW running, change counter_receive to 5 via  on-board debugger. 

then ,  restart the MCU via debugger, the value is reset to 0

thanks and BR

Zhou Yi

0 Likes
Di_W
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 250 solutions authored

Please try to configure UCB to ignore RAM initialization.

0 Likes
Di_W
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 250 solutions authored

Hi ZY, please also refer to this link which is in Chinese.

0 Likes
zhouyi_NJ
Level 3
Level 3
50 sign-ins 10 questions asked 10 replies posted

Hi, dw:

thank you very much. I'll try , but it needs some time to understand it.

thanks and br

ZY

0 Likes