Hi all,
I have created a variable using #pragma location and #pragma NOINIT and assigned a value in one file and I have used it in another file.
The code gets hung when accessing the variable or printing the variable.
Why is this happening?
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi all,
I have created a variable using #pragma location and #pragma NOINIT and assigned a value in one file and I have used it in another file.
The code gets hung when accessing the variable or printing the variable.
Why is this happening?
Your pragma location doesn't look right. I think it should be on the format
#pragma LOCATION( x , address ) int x
Hi Edvard,
Thanks for your reply. I found out that my issue was not due to printing the _bim_var stored using #pragma LOCATION.
It was due to the lines,
const char* bimcode[] = {"Hard Reset", "Downloader Restart", "APP Start", "Bad APP Header", "Bad CRC"};
Display_print1 ("Down Loader :%s", bimcode [ (_bim_var - 0xFF) ] ) ;
Can you suggest an alternate method to print this?
Thanks for your concern.
Regards,
Roshini Radhakrishnan.
Hi Edvard,
Im just trying to display a message based on the _bim_var value;
Consider this,
Example 1
---------------
int temp1;
Display_print0(dispHandle,0,0,"==============================");
const char* bimcode[] = {"Hard Reset", "Downloader Restart", "APP Start", "Bad APP Header", "Bad CRC"};
temp1=3;
Display_print1(dispHandle,0,0,"Down Loader:%s", bimcode[temp1]);
OUTPUT:
==============================
Down Loader:Bad APP Header
Example 2
-----------------
uint32_t _bim_var;
int temp1;
Display_print0(dispHandle,0,0,"==============================");
const char* bimcode[] = {"Hard Reset", "Downloader Restart", "APP Start", "Bad APP Header", "Bad CRC"};
Display_print1(dispHandle,0,0,"BIM VARIABLE:%d", _bim_var); // Value of _bim_var is 258 (Set in bootloader code previously)
temp1=_bim_var-255;
Display_print1(dispHandle,0,0,"TEMP1:%s", temp1); // Value of temp1 printed as 3
Display_print0(dispHandle,0,0,"Rest of the code");
OUTPUT:
==============================
BIM VARIABLE:258
TEMP1:3
Rest of the code
Example 3
-----------------
uint32_t _bim_var;
int temp1;
Display_print0(dispHandle,0,0,"==============================");
const char* bimcode[] = {"Hard Reset", "Downloader Restart", "APP Start", "Bad APP Header", "Bad CRC"};
Display_print1(dispHandle,0,0,"BIM VARIABLE:%d", _bim_var); // Value of _bim_var is 258 (Set in bootloader code previously)
temp1=_bim_var-255;
Display_print1(dispHandle,0,0,"TEMP1:%s", temp1); // Value of temp1 printed as 3
Display_print1(dispHandle,0,0,"Down Loader:%s", bimcode[temp1]); // Code hangs indefinitely because of this line but if removed code works fine
Display_print0(dispHandle,0,0,"Rest of the code");
OUTPUT:
==============================
Only the above line printed
I cant figure out the issue. Why is this happening?
Thanks,
Roshini Radhakrishnan
Hi Edvard,
Thanks for your help and support. I figured out that my issue was due to compiler optimisation. It is set to level 4 (by default) to reduce code size. The code hangs if set to level 4 but is running successfully if optimisation level is set to 3 or below. I cant reduce optimisation level risking code size and therefore has to figure out another method for this above condition.
I think my issue is solved. Thanks for your help.
Regards,
Roshini Radhakrishnan.