stlink-org / stlink

Open source STM32 MCU programming toolset
BSD 3-Clause "New" or "Revised" License
4.4k stars 1.24k forks source link

Error messages doesn't represent root cause #203

Closed fa7ca7 closed 10 years ago

fa7ca7 commented 10 years ago

Environment: STM32VLDISCOVERY board, Sourcery CodeBench toolchain

Compiler generates 2 binary files: project.elf and project.bin. It's OK if I try to flash the chip by st-flash with project.bin. But if I try to flash the chip with project.elf, I get next error:

$ ./st-flash write v1 project.elf 0x08000000 2013-12-30T19:28:23 INFO src/stlink-common.c: Loading device parameters.... 2013-12-30T19:28:23 INFO src/stlink-common.c: Device connected is: F1 Medium-density Value Line device, id 0x10016420 2013-12-30T19:28:23 INFO src/stlink-common.c: SRAM size: 0x2000 bytes (8 KiB), Flash: 0x20000 bytes (128 KiB) in pages of 1024 bytes 2013-12-30T19:28:23 INFO src/stlink-sg.c: Successfully opened a stlink v1 debugger 2013-12-30T19:28:23 INFO src/stlink-common.c: Attempting to write 717947 (0xaf47b) bytes to stm32 address: 134217728 (0x8000000) 2013-12-30T19:28:23 ERROR src/stlink-common.c: addr too high stlink_fwrite_flash() == -1

It would be more informative if the error messages would told about invalid file format.

texane commented 10 years ago

No, this is non sense. Files to be written are not formatted, thus we can not check for the absence of a 'right' format.