SPRUI04F july 2015 – april 2023
#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;
#pragma DATA_MEM_BANK (y, 4)
short y[100];
for (i = 0; i < 100; i++)
{
w[i] = my_count++;
x[i] = my_count++;
y[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 y: 0x%08lx\n", (unsigned long)y);
printf("address of z: 0x%08lx\n", (unsigned long)z);
printf("address of zz: 0x%08lx\n", (unsigned long)zz);
}
Sample output is as follows:
address of w: 0x00006a70
address of x: 0x80009468
address of y: 0x80005f10
address of z: 0x00006b60
address of zz: 0x00006978