mastering-stm32 | examples presented in the `` Mastering STM32 | Robotics library
kandi X-RAY | mastering-stm32 Summary
kandi X-RAY | mastering-stm32 Summary
This repository contains all examples presented in the "Mastering STM32" book, published on the leanpub self-publishing platform.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of mastering-stm32
mastering-stm32 Key Features
mastering-stm32 Examples and Code Snippets
Community Discussions
Trending Discussions on mastering-stm32
QUESTION
I'm building a tiny microcontroller with only the bare essentials for self-educational purposes. This way, I can refresh my knowledge about topics like the linkerscript, the startup code, ...
EDIT:
I got quite a lot of comments pointing out that the "absolute minimal STM32-application" shown below is no good. You are absolutely right when noticing that the vector table is not complete, the .bss
-section is not taken care of, the peripheral addresses are not complete, ... Please allow me to explain why.
It has never been the purpose of the author to write a complete and useful application in this particular chapter. His purpose was to explain step-by-step how a linkerscript works, how startup code works, what the boot procedure of an STM32 looks like, ... purely for educational purposes. I can appreciate this approach, and learned a lot.
The example I have put below is taken from the middle of the chapter in question. The chapter keeps adding more parts to the linkerscript and startup code (for example initialization of
.bss
-section) as it goes forward.
The reason I put files here from the middle of his chapter, is because I got stuck at a particular error message. I want to get that fixed before continuing.The chapter in question is somewhere at the end of his book. It is intended for the more experienced or curious reader who wants to gain deeper knowledge about topics most people don't even consider (most people use the standard linkerscript and startup code given by the manufacturer without ever reading it).
Keeping this in mind, please let us focus on the technical issue at hand (as described below in the error messages). Please also accept my sincere apologies that I didn't clarify the intentions of the writer earlier. But I've done it now, so we can move on ;-)
The tutorial I'm following is chapter 20 from this book: "Mastering STM32" (https://leanpub.com/mastering-stm32). The book explains how to make a tiny microcontroller application with two files: main.c
and linkerscript.ld
. As I'm not using an IDE (like Eclipse), I also added build.bat
and clean.bat
to generate the compilation commands. So my project folder looks like this:
Before I continue, I should perhaps give some more details about my system:
OS: Windows 10, 64-bit
Microcontroller: NUCLEO-F401RE board with STM32F401RE microcontroller.
Compiler:
arm-none-eabi-gcc
version 6.3.1 20170620 (release) [ARM/embedded-6-branch revision 249437].
The main file looks like this:
...ANSWER
Answered 2018-Apr-17 at 18:47The book you're reading has led you astray. Discard it and start learning from another source.
I see at least four major problems with what it has told you to do:
The linker script and
_start
function you included is missing a number of important sections, and will either malfunction or fail to link many executables. Most notably, it lacks any handling for BSS (zero-filled) sections.The vector table in
main.c
is beyond "minimal"; it lacks the required definitions for even the standard ARM interrupt vectors. Without these, debugging hardfaults will become very difficult, as the microcontroller will treat random code following the vector table as an interrupt vector when a fault occurs, which will probably lead to a secondary fault as it fails to load code from that "address".The startup functions given by your book bypass the libc startup functions. This will cause some portions of the standard C library, as well as any C++ code, to fail to work correctly.
You are defining peripheral addresses yourself in
main.c
. These addresses are all defined in standard ST header files (e.g.), so there is no need to define them yourself.
As a starter, I would recommend that you refer to the startup code provided by ST in any of their examples. These will all include a complete linker script and startup code.
QUESTION
I am a newbie in Eclipse and STM32. So I would like to ask you for an advice with a problem which I have been solving. I have got a software for STM32. This software is written in C language and has an existing Makefile. The software is now placed on the SVN server. I need to build the project in Eclipse Neon 4.6.2 IDE running on Windows 7. I have installed the whole GNU ARM Toolchain according to tutorial Mastering STM32. Please can anybody direct me on any step by step instructions how to do that? Thanks in advance. Sed utility warning message
...ANSWER
Answered 2017-Jan-25 at 09:50sed is a unix utility. Maybe executed as a part of your makefile.
The error message is hidden by the second widnow. If it suggests, try to install it on your machine. I use GNU/Linux where it is essential part of the distribution. On Windows you can find a binary after some search.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install mastering-stm32
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page