Using Pragma in MCUXpresso

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Using Pragma in MCUXpresso

ソリューションへジャンプ
2,079件の閲覧回数
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},
...
};

ラベル(1)
タグ(1)
1 解決策
1,836件の閲覧回数
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 件の賞賛
4 返答(返信)
1,837件の閲覧回数
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 件の賞賛
1,836件の閲覧回数
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).

1,836件の閲覧回数
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 件の賞賛
1,836件の閲覧回数
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 件の賞賛