cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F429-Discovery, 70kB array into flash

baev_al
Associate II
Posted on February 27, 2016 at 16:59

Hi.

I would like to play audio wav (mono, 8kHz, 8 bit) file using DAC. I took 10 sec of some record and converted it to wav file with above parameters. The achieved file is about 70kB.

I made a hex file with an array initialized with the values from file. When I try to compile the project I receive a link error.

What is the technique of loading big arrays into flash and how can I read the array later?

Thanks.

5 REPLIES 5
Radosław
Senior II
Posted on February 27, 2016 at 17:05

1.  Toolchian?

2. Why you don't generate *c file with this data ?

baev_al
Associate II
Posted on February 27, 2016 at 17:17

1. Toolchain - IAR EWARM 7.5

2. What is the difference if I genrate c file or h file in this case?

Radosław
Senior II
Posted on February 27, 2016 at 17:30

ad 2.  Data must be in *.c file.

in *.h  put extern declaration.

Search program that generetes  c files with data.

baev_al
Associate II
Posted on February 27, 2016 at 19:35

I declared the array in a c file as const uint8_t. In main.c file I declared it as extern uint8_t. The compilation is ok. I have not tested it in hardware yet.

Just for learning purpse - why I cannot declare the same in the header file? Everything that is included in a header file appeares in the place of header file definition. Right?

Radosław
Senior II
Posted on February 27, 2016 at 19:54

Becase each time that you include this h file, this table will be created in memory.

But first you will get error on double declaration.