not enough working area available

Hi All,

Do you have any idea what is wrong with this? The target did not blink any way. Thanks.

halt

stm32x mass_erase 0

stm32x mass erase complete

flash write_bank 0 main.bin 0

not enough working area available(requested 16384, free 8144)

wrote 4052 bytes from file main.bin to flash bank 0 at offset 0x00000000 in 0.329977s (11.992 kb/s)

Nothing is wrong here - this is just a warning which tells you that the flashing procedures will use less RAM than desired - this affects speed of flashing only. If you want to get rid of this warning, you can decrease the working area size in the stm32.cfg file, but this won’t change anything.

Your problem must be somewhere else.

4/3!!

Hi,

Please give me some clues on this issue.

Is it the compiler problem? Or OpenOCD problem? Or some thing else?

Thank you.

STM32 chips have flash from 0x8000000, the “thing” that is mapped at 0 can be RAM, bootloader or flash. If you want to be sure, write data to addresses starting from 0x8000000

Anyway - I think that you have a problem with your code, not with the tools. You can try the examples that can be found on my webpage - just setup the port & pin of the LED, crystal frequency and it will work.

4/3!!

Hi,

I still got the same result. Do I need to change any thing in the code? Can you explain further for “just setup the port & pin of the LED, crystal frequency”?

Thank you.

stm32x mass_erase 0

stm32x mass erase complete

flash write_image stm32_blink_led.bin 0x8000000 bin

not enough working area available(requested 16384, free 8144)

wrote 840 bytes from file stm32_blink_led.bin in 0.191009s (4.295 kb/s)

mytzeng:
Do I need to change any thing in the code? Can you explain further for “just setup the port & pin of the LED, crystal frequency”?

Take a look at config.h - you'll find basic project configuration there:
#define CRYSTAL								8000000ul	///< quartz crystal resonator which is connected to the chip
#define FREQUENCY							72000000ul	///< desired target frequency of the core

#define LED_GPIO							GPIOB		///< GPIO port to which the LED is connected

#define LED_pin								1			///< pin number of the LED

You need to change those 4 defines to fit your case. If you don’t want to use external crystal, comment the call to pll_start() in main().

flash write_image stm32_blink_led.bin 0x8000000 bin

It's always better / safer to load hex or elf files, not binary versions.

4/3!!

Hi,

How do I know which one to choose? That is, GPIOA, GPIOB, or GPIOC?

How about LED pin number is 1? Where to get this information?

And is the command usage “flash write_image main.hex 0x8000000 hex” or “flash write_image main.elf 0x8000000 elf” correct?

Thanks.

mytzeng:
How do I know which one to choose? That is, GPIOA, GPIOB, or GPIOC?

How about LED pin number is 1? Where to get this information?

Are you asking ME where YOU have YOUR led connected?

And is the command usage “flash write_image main.hex 0x8000000 hex” or “flash write_image main.elf 0x8000000 elf” correct?

Generally you don't need any offset for hex of elf files, so just "flash write_image main.hex" is enough.

4/3!!

Hi,

Sorry to ask this stupid question: it is a stm3210c-eval standard board without changing any thing. I am not familiar with the hardware at this stage. Just point me which one to choose (or where I can locate the information).

Thanks a lot.

You need to check out the schematics of this board and find out to which port & pin the LED is connected.

4/3!!

Hi,

I have changed the GPIO to GPIOA(corresponding to LED1?), LED pin number to 88 (corresponding to LED1) and comment out the pll_start() call.

After cross compiled the code, I have tried to “flash write_image main.elf” or “flash write_image main.hex”. But still got the same result: No LED flashing.

Is the procedure correct?

Thanks.

OMG… you don’t define the pin number of the package, but the pin number in the port… GPIOA6 is pin no 6, GPIOA15 is pin no 15.

4/3!!

Is it this board?

http://www.st.com/mcu/modules.php?name= … 3210C-EVAL

http://www.st.com/stonline/products/lit … /15082.pdf

check out the first page of the schematics, led’s are connected to PD3,4,7,13.

As freddie said, the actual ‘pin number’ of the chip is meaningless to code, you deal with the name of the I/O pin. Pin numbers are for schematics. Pin names are for code (which are usually shown in the header file for that particular chip).

I would have thought ST provide plenty of example code to show basic I/O manipulation.

Hi,

Thank you for your information. That is the board I am trying on!

I have changed to the following in the code:

GPIOD (since PD7)

and pin number as 7 (since LED1)

Is it correct?

If so, it still not worked.

By the way, please point me the I/O samples STMicro provided.

What do you mean it still doesn’t work?

  • Does the code compile?

  • What config file for openOCD are you using?

  • What does openocd say when you try to program the flash?

I realize its complicated, so take it in stages. First you have to make sure your compiled code is ok. Then worry about if your hardware/openocd can talk to your board. Then worry about flashing :slight_smile:

Hi,

Below is what I did (no problem for the compilation), the olimex-arm-usb-ocd light is green/yellow flashing, but the board’s led did not flash.

One weir thing I got below is “wrote 840 bytes from file stm32_blink_led.elf”, the elf file is bigger than 840 bytes.

Thanks.


840 2010-02-25 09:30 stm32_blink_led.bin

266272 2010-02-25 09:29 stm32_blink_led.elf

2420 2010-02-25 09:30 stm32_blink_led.hex


telnet localhost 4444

Trying ::1…

Trying 127.0.0.1…

Connected to localhost.

Escape character is ‘^]’.

Open On-Chip Debugger

flash probe 0

Target not halted

unknown error when probing flash bank ‘#0’ at 0x00000000

halt

target state: halted

target halted due to debug-request, current mode: Thread

xPSR: 0x81000000 pc: 0x080001c8 psp: 0x200007f0

flash probe 0

device id = 0x10016418

flash size = 256kbytes

flash ‘stm32x’ found at 0x08000000

flash info 0

#0 : stm32x at 0x08000000, size 0x00040000, buswidth 0, chipwidth 0

0: 0x00000000 (0x800 2kB) protected

1: 0x00000800 (0x800 2kB) protected

2: 0x00001000 (0x800 2kB) protected

3: 0x00001800 (0x800 2kB) protected

#125: 0x0003e800 (0x800 2kB) protected

#126: 0x0003f000 (0x800 2kB) protected

#127: 0x0003f800 (0x800 2kB) protected

stm32x (Connectivity) - Rev: Z

stm32x mass_erase 0

stm32x mass erase complete

flash write_image stm32_blink_led.bin 0x08000000 bin

not enough working area available(requested 16384, free 16336)

wrote 840 bytes from file stm32_blink_led.bin in 0.195986s (4.186 kb/s)

stm32x mass_erase 0

stm32x mass erase complete

flash write_image stm32_blink_led.elf

not enough working area available(requested 16384, free 8144)

wrote 840 bytes from file stm32_blink_led.elf in 0.205856s (3.985 kb/s)

stm32x mass_erase 0

stm32x mass erase complete

flash write_image stm32_blink_led.hex

not enough working area available(requested 16384, free 8144)

wrote 840 bytes from file stm32_blink_led.hex in 0.233992s (3.506 kb/s)

You do realize that when you halt the chip it DOES NOT automagically start running after you flash something…

Disconnect the JTAG and reset the board or type “reset run” after flashing…

4/3!!