ZHCUAU3J January 2018 – March 2024
#include <stdio.h>
#pragma DATA_MEM_BANK (x, 2)
short x[100];
#pragma DATA_MEM_BANK (z, 0)
#pragma DATA_SECTION (z, ".z_sect")
short z[100];
#pragma DATA_MEM_BANK (w, 4)
#pragma DATA_SECTION (w, ".w_sect")
short w[100];
#pragma DATA_MEM_BANK (zz, 6)
#pragma DATA_SECTION (zz, ".zz_sect")
short zz[100];
static short my_count = 0;
void main()
{
int i;
for (i = 0; i < 100; i++)
{
w[i] = my_count++;
x[i] = my_count++;
z[i] = my_count++;
zz[i] = my_count++;
}
printf("address of w: 0x%08lx\n", (unsigned long)w);
printf("address of x: 0x%08lx\n", (unsigned long)x);
printf("address of z: 0x%08lx\n", (unsigned long)z);
printf("address of zz: 0x%08lx\n", (unsigned long)zz);
}
示例输出如下:
address of w: 0x0000cba0
address of x: 0x0000c610
address of z: 0x0000cc80
address of zz: 0x0000cab0