Using Pragma in MCUXpresso

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

Using Pragma in MCUXpresso

Jump to solution
2,845 Views
m_giraldi
Contributor II

I'm wondering how to use Pragam on MCUXpresso IDE (MKE16Z64xxx4). How should I proceed? I need to put an array of values in Flash.

#pragma ...

  const float min_max [23] [2]
=
{
{3.1415, 2.54},
...
};

Labels (1)
Tags (1)
1 Solution
2,602 Views
BlackNight
NXP Employee
NXP Employee

What kind of attribute do you want to use?

The standard way to tell the compiler special ways for gcc is using __attribute__ (see Using the GNU Compiler Collection (GCC): Common Variable Attributes ).

I hope this helps,

Erich

View solution in original post

0 Kudos
Reply
4 Replies
2,603 Views
BlackNight
NXP Employee
NXP Employee

What kind of attribute do you want to use?

The standard way to tell the compiler special ways for gcc is using __attribute__ (see Using the GNU Compiler Collection (GCC): Common Variable Attributes ).

I hope this helps,

Erich

0 Kudos
Reply
2,602 Views
converse
Senior Contributor V

Read the MCUXpresso Usr Guide. NXP provide macros to help you do this, as described in the chapter on Placing specific code/data items. (Chapter 18.13 in latest user guide).

2,602 Views
m_giraldi
Contributor II

Erich,

Imagine the data below ( const unsigned char texto[4][128] ), if I declare this way, this data will be allocated in the SRAM, I do not want this to happen, I need this data to be allocated in Flash. In Codewarrior I used the pragma and this data was allocated in ROM.

// Codewarrior ========================================
#pragma CONST_SEG ROM
/ *  "in here I put all the const that I needed to be allocated in ROM"  * /
const unsigned char texto[4][128] = { .... };

#pragma CONST_SEG DEFAULT

//==================================================

How to allocate " const unsigned char texto[4][128] " in Flash and not in SRAM using MCUXpresso?

I'm using MKE16Z64VLF4

"data"

const unsigned char texto[4][128] = { {0xFF, 0xFF, ... }, {0xFF, 0xFF, ....}, {0xFF, 0xFF, ...}, {0xFF, 0xFF, ...} };

0 Kudos
Reply
2,602 Views
BlackNight
NXP Employee
NXP Employee

If you are using the default/standard SDK linker files, then all constant objects get placed in FLASH anyway, so you don't need any #pragma.

I hope this helps,

Erich

0 Kudos
Reply