Topic : Array location pointers

Forum : ARM

Original Post
Post Information Post
June 17, 2009 - 8:36pm
Guest

Hi

I'm newbie in GCC microcontroller programming. I found some problem with constant array reading.
There is example:

---

const unsigned char flash_array[4] = {0x01, 0x23, 0x45, 0x67};
unsigned char ram_array[4] = {0x76, 0x54, 0x32, 0x10};

int main(void)
{
unsigned char chr0, chr1, chr2, chr3, chr4, chr5, chr6, chr7;

chr0 = flash_array[0];
chr1 = flash_array[1];
chr2 = flash_array[2];
chr3 = flash_array[3];

chr4 = ram_array[0];
chr5 = ram_array[1];
chr6 = ram_array[2];
chr7 = ram_array[3];
};

---

Running above in RIDE simlulator gives result as expected. Running it with Rlink connected to real processor
(STM32F103RET) in boot mode RAM gives unexpected result: constant array is located (pointed) into FLASH
area, where are clear bytes (0xFF). So what should I do? What I'm doing wrong?

Regards

Replies
Post Information Post
+1
0
-1
June 22, 2009 - 6:17pm
Guest

Problem solved. It was because of harware error: Jtag line NRST was not connected to CPU.
Thanks Artur I. :)