Page 1 of 2

I want to create a 'hex' file via 'STM32Duino' (Arduino sketch).

Posted: Fri Jul 21, 2023 12:16 pm
by myksj1105
I want to create a 'hex' file via 'STM32Duino' (Arduino sketch).

hello. Nice to meet you.

Image

What I want to do now is:
1. Can I put the 'STM32F103C8T6' firmware without giving the Arduino Sketch source code?
2. It was found that '.bin' and 'elf' files were created through Arduino sketch.
3. Can I create a 'hex' file through 'Arduino Sketch'?
4. Also, if I created a 'hex' file, how should I put the 'firmware'?
5. Can I put it through 'STM32 ST-LINK' program?

If you know, please help.

Re: I want to create a 'hex' file via 'STM32Duino' (Arduino sketch).

Posted: Fri Jul 21, 2023 2:38 pm
by ag123
normally, ST-Link and other (e.g. serial) flashers use the bin file,
but you can try things like

Code: Select all

arm-none-eabi-objcopy --input-target=binary --output-target=ihex sketch.bin sketch.hex

Re: I want to create a 'hex' file via 'STM32Duino' (Arduino sketch).

Posted: Sat Jul 22, 2023 11:53 am
by myksj1105
@ag123

Thank you for answer.
1) Isn't the .bin file 'bootloader' information?
2) Can you upload the .bin file?

Re: I want to create a 'hex' file via 'STM32Duino' (Arduino sketch).

Posted: Sat Jul 22, 2023 1:26 pm
by GonzoG
No. .bin extension is for "binary". STM32 MCUs use binary files for firmware upload. You need .bin file if you want to upload firmware to STM32 MCU, unless you have an application that converts HEX file into binary format before uploading it.

Re: I want to create a 'hex' file via 'STM32Duino' (Arduino sketch).

Posted: Sat Jul 22, 2023 2:19 pm
by ag123
like @GonzoG mentions, that bin file is your 'sketch', that is the firmware.
and if you are using a STM32F103C8T6,

you would need either a ST Link v2 dongle.
https://www.adafruit.com/product/2548
https://www.st.com/en/development-tools/st-link-v2.html
https://octopart.com/search?q=st-link+v ... SD&specs=0

or a 3.3v usb-uart dongle
https://www.sgbotic.com/index.php?dispa ... page_id=48

other intro stuff
the 'official' core is here
https://github.com/stm32duino/Arduino_Core_STM32
and the wiki is normally where to get started
https://github.com/stm32duino/Arduino_Core_STM32/wiki

Re: I want to create a 'hex' file via 'STM32Duino' (Arduino sketch).

Posted: Sun Jul 23, 2023 11:01 am
by myksj1105
@GonzoG
@ag123

Thank you very much.
Thank you for your kind explanation.

I will leave a reply after testing.
thank you

Re: I want to create a 'hex' file via 'STM32Duino' (Arduino sketch).

Posted: Thu Aug 10, 2023 2:19 am
by myksj1105
@GonzoG
@ag123

1. Open 'STM32 ST-LINK Utility'.
2. Connect the target.
3. After clicking the program 'verify'
4. I put the '.bin' file created in the Arduino sketch.
'bin file download url : https://drive.google.com/file/d/1dWZzM7 ... drive_link
https://drive.google.com/file/d/1dWZzM7 ... drive_link

5. But it doesn't work.

What's the reason?

Re: I want to create a 'hex' file via 'STM32Duino' (Arduino sketch).

Posted: Thu Aug 10, 2023 5:39 am
by ag123
if you are on Windows, you can try using STM32Cube programmer
https://www.st.com/en/development-tools ... eprog.html
to flash your binaries.

for the bin file normally, on the Ardunio IDE menu there is Sketch > Export compiled binary or some such, that should leave the bin file in your sketch folder.

Re: I want to create a 'hex' file via 'STM32Duino' (Arduino sketch).

Posted: Thu Aug 10, 2023 6:43 am
by myksj1105
@ag123

1. I used the following files as boot.
'generic_boot20_pc13.bin'

2. I created a 'bin' file through the Arduino sketch.

3. JTAG connection was made through 'STM32CubeProgrammer'.

4. I put the 'bin' file, but it doesn't work.
- 'Is it a problem because of the serial function?'

Re: I want to create a 'hex' file via 'STM32Duino' (Arduino sketch).

Posted: Thu Aug 10, 2023 6:59 am
by ag123
did you use that st-link dongle as like discussed?
https://www.adafruit.com/product/2548
https://www.st.com/en/development-tools/st-link-v2.html

stm32f103xx needs to use that st-link dongle or a usb-uart dongle to program it.

if the programming succeeds but that the sketch didn't work, that is a different issue

note that the 'official' stm core is here
https://github.com/stm32duino/Arduino_Core_STM32
and the wiki is here
https://github.com/stm32duino/Arduino_Core_STM32/wiki
there is an 'old' (Libmaple) community core here and the wiki in the repository
https://github.com/rogerclarkmelbourne/Arduino_STM32

there are some other cores / copies of the codes scattered around the internet which are likely forks of these original or that they may be different implementations.

then not least, there are 'clone' stm32f103 'like' chips which may not be made by ST, make sure you are using an original STM32 if you are after all using the original stm32 tools. then for the boards, check the chips, some vendors substitute different chips e.g. stm32f103c6 (only 32k flash) rather than the correct stm32f103c8 (64k flash) or better stm32f103cb (128k flash) chips. and some vendors substitute 'clone' chips on the boards

if you are new to stm32
get one of the Nucleo boards
https://github.com/stm32duino/Arduino_C ... -64-boards
like Nucleo F401RE
https://www.st.com/en/evaluation-tools/ ... 401re.html
Nucleo F401RE
https://www.st.com/en/evaluation-tools/ ... 411re.html

then Adafruit has a board with much faster chip stm32f405
https://www.adafruit.com/product/4382
https://github.com/stm32duino/Arduino_C ... 2f4-boards
which is also used in the micropython board
https://store.micropython.org/product/PYBLITEv1.0
and Olimex has something similar
https://www.olimex.com/Products/ARM/ST/STM32-H405/

there are also other boards e.g. the stm32f401 / f411 'blackpill' type boards. etc. search the online markets for them.

these boards and chips are recommended because they have lots of sram and flash, and stm32f405 is fast, so that you won't need to worry about it mostly while getting started learning the mcu platform. STM32 is a large family of microcontrollers.
if you use the 'official' STM core
https://github.com/stm32duino/Arduino_Core_STM32
it would be much easier to switch between different microcontrollers in the family.

Then for boards, there are many with different stm32 chips and that extends further to 3d printer boards a lot of them use stm32 among the offereings.