一、LDF文件设置内存空间
user_data_test { TYPE(BW RAM) START(0x00380010) END(0x0039bfff) WIDTH(8) }//usr data
dxe_user_data_bw BW
{
INPUT_SECTION_ALIGN(4)
INPUT_SECTIONS( $OBJS_LIBS(user_data) )
} > user_data_test
二、在C文件中设置数据
/*****************************************************************************
* MemoryLayout.c
*****************************************************************************/
#include <sys/platform.h>
#include "adi_initialize.h"
#include "MemoryLayout.h"
#include <stdio.h>
/**
* If you want to use command program arguments, then place them in the following string.
*/
char __argv_string[] = "";
#pragma section("user_data")
static int32_t user[100] = {0};
int main(int argc, char *argv[])
{
/**
* Initialize managed drivers and/or services that have been added to
* the project.
* @return zero on success
*/
adi_initComponents();
/* Begin adding your custom code here */
user[0] = 76;
user[1] = 17;
int32_t a = *(uint32_t *)0x00380010;
int32_t b = *(uint32_t *)0x00380014;
printf("Currently number is:%d\r\n", a);
printf("Currently number is:%d\r\n", b);
*(uint32_t *)0x00380010 = 188;
int32_t c = *(uint32_t *)0x00380010;
printf("Currently number is:%d\r\n", c);
return 0;
}
三、测试
测试🆗