NXPの技術スタッフの皆様、こんにちは。
S32K144チップの開発中に問題が発生しました。
カスタムROMフィールドにいくつかの変数を設定したいのですが、プログラム内でどのように設定すればよいのか分かりません。
S32K144_64_flash.ldでストレージフィールドを定義しました。
CALC_RAMはSECTIONSで定義されています。
#define CALC_RAM_ATTRIBUTE__attribute__ ((section(".CALC_RAM")))
CALC_RAM_ATTRIBUTE const uint8_t my_flash_array[] = {0x01, 0x02, 0x03, 0x04};
CALC_RAM_ATTRIBUTE const uint8_t my_flash_brray[] = {0x01, 0x02, 0x03, 0x04};
CALC_RAM_ATTRIBUTE const uint8_t my_flash_crray[] = {0x01, 0x02, 0x03, 0x04};
上記のコードは、私の配列をCALC_RAMのカスタムフィールドに配置しました。
私の疑問は、この方法がかなり面倒だということです。マクロCALC_RAM_ATTRIBUTEを新しく定義する配列ごとに追加する必要があるため、カスタムフィールドCALC_RAMにデータを一括保存するもっと便利な方法はありますか?
お返事をお待ちしております。
どうもありがとうございます!
こんにちは、 @Ni_ さん。
一般的に、選択肢は3つあります。
選択肢1。
作業を進める際は、属性を維持してください。
選択肢2。
すべてを専用のソースファイルに記述してください。例えば、次のようになります。
/* cal_data.c */
#include
const uint8_t table1[] = { 0x01, 0x02, 0x03, 0x04 };
const uint8_t table2[] = { 0x10, 0x20, 0x30, 0x40 };
const uint8_t table3[] = { 0xAA, 0xBB, 0xCC, 0xDD };
次にリンカーファイルで:
MEMORY
{
int_flash_interrupts : ORIGIN = 0x00000000, LENGTH = 0x00000400
int_flash_config : ORIGIN = 0x00000400, LENGTH = 0x00000010
int_flash : ORIGIN = 0x00000410, LENGTH = 0x0007BBF0
calib_flash : ORIGIN = 0x0007C000, LENGTH = 0x00004000
int_sram_results : ORIGIN = 0x1FFF8000, LENGTH = 0x00000100
int_sram : ORIGIN = 0x1FFF8100, LENGTH = 0x0000DF00
int_sram_stack_c0 : ORIGIN = 0x20006000, LENGTH = 0x00001000
ram_rsvd2 : ORIGIN = 0x20007000, LENGTH = 0
}
.flash_config :
{
KEEP(*(.flash_config))
} > int_flash_config
.calib_flash :
{
. = ALIGN(4);
__calib_flash_start = .;
KEEP(*cal_data.o(.rodata*))
. = ALIGN(4);
__calib_flash_end = .;
} > calib_flash
.flash :
{
. = ALIGN(4);
*(.startup)
. = ALIGN(4);
*(.systeminit)
. = ALIGN(4);
*(.text.startup)
. = ALIGN(4);
.mapファイル内ファイル:
選択肢3。
セクション pragma/macros を使用します。
一部のコンパイラはサポートしていますが、GCCはサポートしていません。
よろしくお願いいたします。
ダニエル
Any support, information, and technology (“Materials”) provided by NXP are provided AS IS, without any warranty express or implied, and NXP disclaims all direct and indirect liability and damages in connection with the Material to the maximum extent permitted by the applicable law.
NXP accepts no liability for any assistance with applications or product design. Materials may only be used in connection with NXP products. Any feedback provided to NXP regarding the Materials may be used by NXP without restriction.