Mbed C program - bin file is not flashed.

29 Aug 2017

I have created program in mbed online compiler environment. It does not use neither mbed libraries nor C++. Program compiles susccessfully and bin file can be downloaded. But it is not flashed to my Nucleo board (STM32F401) after file is copied to USB drive. Bin stays on usb drive as usual file. I tried examples from mbed and they are sucessfully flashed and work.

1) Could you, please, help me to resolve this problem? 2) How can I resolve this problem in general? 3) What is binary file format and why it is not flashed?

Program link: https://developer.mbed.org/users/PavelSavyhin/code/nucleo-aws-iot-demo-draft/ Compile macros should be added to compile it successfully (mbed online does not save it to repo): NUCLEO_F401RE STM32F4 STM32F401RETx STM32 ARM_MATH_CM4 USE_STM32F4XX_NUCLEO MBEDTLS_FS_IO MBEDTLS_PEM_PARSE_C MBEDTLS_X509_USE_C MBEDTLS_PLATFORM_C USART_PRINT_MSG USE_HAL_DRIVER STM32F401xE TARGET_FPU_VFP IOT_ERROR IOT_INFO IOT_DEBUG

30 Aug 2017

Compile macros should be added to compile it successfully

This seems odd. Are you sure you're compiling for the right target?

30 Aug 2017

Jan Jongboom wrote:

This seems odd. Are you sure you're compiling for the right target?

Yes, I'm sure. Note, please, that I'm not using mbed OS.

31 Aug 2017

A binary file format is simply the raw binary data of your compiled program (machine code). When you program the chip this binary data gets copied directly to the start of flash memory (0x08000000 for f401). In my experience in Windows 10, when I drag files to the USB drive they always appear to stay there regardless of whether the stlink/mbed interface flashed them successfully or not. I would not necessarily take that as an indication programming has failed.

You can also flash binary files to the target using STLink Utility desktop application. A bin file does not contain the start address info, so you have to ensure it flashes it to the address above (a pop up asks you after you hit program). Free program but requires creating a login. This might provide more troubleshooting messages.

http://www.st.com/content/st_com/en/products/development-tools/software-development-tools/stm32-software-development-tools/stm32-programmers/stsw-link004.html

31 Aug 2017

Dear Graham,

I was able to flash binary file, after I have included mbed library to the project. But this made no help to me, cause program was not able to start properly. So, due to number of further investigations I understood that there is no chance to port my program to mbed.

Graham S. wrote:

A binary file format is simply the raw binary data of your compiled program (machine code). When you program the chip this binary data gets copied directly to the start of flash memory (0x08000000 for f401). In my experience in Windows 10, when I drag files to the USB drive they always appear to stay there regardless of whether the stlink/mbed interface flashed them successfully or not. I would not necessarily take that as an indication programming has failed.

You can also flash binary files to the target using STLink Utility desktop application. A bin file does not contain the start address info, so you have to ensure it flashes it to the address above (a pop up asks you after you hit program). Free program but requires creating a login. This might provide more troubleshooting messages.

http://www.st.com/content/st_com/en/products/development-tools/software-development-tools/stm32-software-development-tools/stm32-programmers/stsw-link004.html