Tuesday, October 11, 2016

STM32 develop embed programs by gcc environment.

I made development for STM32f429 discovery uClinux environment.
This time, let it add gcc development on my environment. Because, I have STM32f429 discovery and STM32f303 discovery boards.

First: Installing toolchain.
It needs Arm instruction set compiling and working out binary files tools.
And, the binary files are made by ARM non eabi mode instruction set.
It tools called "Toolchain", that you can be able to get running on your PC binaries from the Web.
binutils-arm-none-eabi, gcc-arm-none-eabi

You can install your PC(Ubuntu) by the "apt-get" command.
$ apt-get install binutils-arm-none-eabi gcc-arm-none-eabi

Confirmation passes installing by below command.
$ arm-none-eabi-gcc --version
arm-none-eabi-gcc (4.8.2-1ubuntu1+6) 4.8.2
Copyright (C) 2013 Free software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A particular purpose.
$


Next: Installing STM32 firmware.
There is libopencm3 project that is ARM multi platform hardware farmware developing.
I choice that project.

Getting source tree from git command.
$ git clone https://github.com/libopencm3/libopencm3-examples.git<

Making firmware. 
$ cd libopencm3
$ git submodule init
$ git submodule update
$ make


Examples: Getting start !
Showing a STM32f303 discovery board example doing.
$ cd examples/stm32/f3/stm32f3-discovery/miniblink
$ make

Connection your STM32f303 discovery board on your PC via USB cable, and start openocd.
$ sudo openocd -f /usr/local/share/openocd/script/board/stm32f3discovery.cfg

And, you open other terminal and run telnet to connect openocd and flash operations..
$ telnet 4444
reset halt
flash write_image erase miniblink.elf
reset

If successflly write STM32f303 discovery board, when light blue LED !


Showing a STM32f429 discovery board example doing.
To do STM32f429 discovery board is the same STM32f303 doscovery bord.
$ cd examples/stm32/f4/stm32f429-discovery/miniblink
$ make

Connection your STM32f429 discovery board on your PC via USB cable, and start openocd.
$ sudo openocd -f /usr/local/share/openocd/script/board/stm32f429discovery.cfg

And, you open other terminal and run telnet to connect openocd and flash operations.
$ telnet 4444
reset halt
flash write_image erase miniblink.elf
reset

If successflly write STM32f29 discovery board, when light green LED(LED3) !


Flash writing use OpenOCD.
  How to get and install OpemPCD to see old my blog.


Let's enjoy computing !


No comments:

Post a Comment