2018-02-18 10:55 AM
A few days ago I got a few STM32 boards (STM32F0-Discovery, STM32F031 Nucleo-32, STM32F302 Nucleo-64) to have a quick look at the STM
Is there some simple 'Hello, World!'-style tutorial, that shows setting up an UART for printf() and possibly basic use of timers? I want to use a free toolchain (I have the arm-none-eabi-gcc Debian package installed, and compiled texane stlink). I want to avoid the use of complex or non-free stuff (IDE, Cube, libraries such as SPL or HAL). Basically I'm looking for a tutorial like the
http://www.colecovision.eu/stm8/STM8S-DISCOVERY%20Serial.shtml
, but for an STMPhilipp
P.S.: By 'with standard library' I mean that functions from the standard library that make sense for, but are not required by, a freestanding C implementation (e.g. the string.h stuff) should be available.
#bare-metal-arm #gcc #stm32f0 #tutorial Note: this post was migrated and contained many threaded conversations, some content may be missing.2018-02-18 12:13 PM
2018-02-18 01:42 PM
For basic getting-started tips, see:
2018-02-18 01:45 PM
Is there some simple 'Hello, World!'-style tutorial, [...] I want to avoid the use of complex or non-free stuff (IDE, Cube, libraries such as SPL or HAL).
Then no.
Welcome to the wonderful 32-bit world!
Jan Waclawek
PS. My take on this at
but only a few randomly chosen boards and tasks. Some rudimentary example in thehttp://www.st.com/en/embedded-software/stm32snippetsf0.html
.I honestly want you to learn to hate the 32-bitters very quickly as we need you desperately for SDCC.
2018-02-18 02:03 PM
'Basically I'm looking for a tutorial like the
/external-link.jspa?url=http%3A%2F%2Fwww.colecovision.eu%2Fstm8%2FSTM8S-DISCOVERY%2520Serial.shtml
, but for an STM'that tutorial relies on non-standard libraries, to borrow your terminology.
'P.S.: By 'with standard library' I mean that functions from the standard library'
basically, you have free tools, you have cmd tools, ..... the moment it comes to access onboard peripherals, none of them exist anymore.
so if you have to code with 'standard libraries' exclusively, stay on your PC.
2018-02-18 11:15 PM
When I wanted to switch to ARM (a few years ago) I was in the same situation. Started with TI ARM as they had nice tutorials at that time. Moved to STM32 because they had more stable IDE (I mean Keil because I used to use TI IDE for TI ARM which was awful for me).
I think I should have started with reading reference guides and programming at the register level. Especially if you are experienced in other MCUs.
When you start with CubeMX/HAL/LL you also need to study RM because the abstraction provided by the HAL/LL is not clear (at least for me).
I think that the mentioned earlier book is good to see the difference between the 8bit MCU and ARMs:
/external-link.jspa?url=https%3A%2F%2Fwww.cs.indiana.edu%2F%7Egeobrown%2Fbook.pdf
But I am only hobbyist, not professional.
2018-02-19 01:07 AM
I don't see any use of non-standard libraries in the STM8 tutorial.
It uses stdint.h, which is a mandatory standard library header for freestanding implementation of C, and the type uint8_t,the availability of which is implementation-defined, but required for any implementation that has an 8-bit type at all. It also uses stdio.h and printf(). While these are not mandatory for freestanding implementations, they are still useful. The tutorial uses SDCC, and for the printf() that comes with SDCC, the way to specify where the printf() output goes is by the user providing a custom putcher().
Philipp
2018-02-19 01:26 AM
Don't worry. For now I just want to get a few performance numbers - Scores for the Whetstone, Dhrystone, Coremark and stdcbench benchmarks to compare with the 8-bit devices.
Maybe, in the long term, if I find the time to do so, knowing the STM32 might be helpful in porting the RTOS RIOT from the STM32 to the STM8.
Philipp
2018-02-19 02:04 AM
I came to STM32 last year whenI started a professional product for a machine controller.
First of all I got evaluation boards, like you did, and tested the various libraries and rtos.
From my experience the HAL generates more problems than it solves due to its
unnecessary complexity.
My library of choice it the STM32 standard library. It allows me to initialize all hardware components perfectly.
I also use Cube MX, but only to get hints about hardware usage, not to generate software.
I use the System Workbench for STM32 which works very reliably and never made any problem during development of my controller. System Workbench generates a simple and basic skeleton for the software which helps a lot to get started.
For a Hello World style program you can do a LED blinker for your eval boards which is done with a few lines of code.
Good Luck
Harry
2018-02-19 02:46 AM
Last year I needed simple ARM for simple task and discovered LPC810 (an NXP product). So started from scratch with the new vendor. Of course it's also an ARM so I started from register level programming (and errata documents). This approach was was really good in this case but frankly the LPC810 is not very complicated device (GPIO, UART, I2C, SPI, comparator, and simple clocking system).
To make my comment valuable: this forum is a great source of knowledge and help. There are some very skilled engineers (see the top guys on the rank list) who are willing to help.