Loading...
 

SW4STM32 and SW4Linux fully supports the STM32MP1 asymmetric multicore Cortex/A7+M4 MPUs

   With System Workbench for Linux, Embedded Linux on the STM32MP1 family of MPUs from ST was never as simple to build and maintain, even for newcomers in the Linux world. And, if you install System Workbench for Linux in System Workbench for STM32 you can seamlessly develop and debug asymmetric applications running partly on Linux, partly on the Cortex-M4.
You can get more information from the ac6-tools website and download (registration required) various documents highlighting:

System Workbench for STM32


Successfully Built Blinky in Eclipse Luna and Linux on STM32F429I-Disco

I did It!!
I successfully got a Blinky program to build and run on my ST32F429I-DIscovery board(the LCD version).
I have done this in linux and I am estatic becuase this was my last hurdle to be 100% windows free!!

I am using Ultimate Edition Linux 4.3.2 with Kernel 4.2.3, it is a Ubuntu 14.04 based distro with many DE’s installed, currently I am using XFCE4.12.

I started out with Ecilpse Mars and it seems to be giltchy so I switch back to Luna and after plugging around for a few hours I finally got it to work and verifed the program by changing the flashing speed of the LED.

I have had this board for almost 3 years now and I have been wanting to use it, I did get blinky to work in CoCox before not so long ago, but I wanted all of my Electronic Development to happen in linux now, and that day has now come!!! wink

Now when I look back on all of the steps this was a lot easier to do than it was making it work in CooCox.
I am not sure what was giving me trouble at first but it is working now and that is all that matters!!
Cheers!! :-D

jer :-)

Well, nice to hear that you succeeded with this ... but you did not write HOW ... Would you be able to tell us step by step please ? I would also like to know if you were able to build a Release version - I get only Debug right now.

Thanks :-) !

I didn’t write exactly how because it was the very First time I had done it.

However I am perparing a step by step description of how I created my first blinky project on this platform.

I know how you feel as I have been though almost every tuorial out there and got no where with them due to version changes or lack of details.
I am hoping that this well help more to people to get started with this great little board.

I will already assume that you have Eclipse installed, I am using the Luna version as I had problems with using Mars version locking up in some menus on me in linux, and, these are known issues that they are working on.

Also I will assume to that you have the “System Workbench for STM32-Bare Metal Edition” installed in Eclipse as well, the directions are in these pages and it is very simple to do,

http://www.openstm32.org/Installing+System+Workbench+for+STM32?structure=DocumentationQuestion

This is the page for installing it in Eclipse,

http://www.openstm32.org/Installing+System+Workbench+for+STM32+from+EclipseQuestion

I am using “qstlink2” to program my board, it works great but sometimes it hangs a little and you have to hit the reset button on the Discovery Board and then click on Run MCU in the Qstlink2 GUI and your progarm will start running, Othertimes the board will automatically reset and start running, I am sure there is a reason for this but I don’t know what it is at this time.

Qstlink 2 can be found here,

https://github.com/fpoussin/qstlink2Question

This page is great help for getting everything setup as well,

http://vedder.se/2012/07/get-started-with-stm32f4-on-ubuntu-linux/Question

After doing it so many times I found that by just adding the PPA found on this page for your distro is the easiest methed.

https://launchpad.net/~fpoussin/+archive/ubuntu/ppaQuestion

And then just use “apt-get install qstlink2” and it will install it and create the icon for you as well to add to your panels for launching.

Then all you have to do is copy the dev rules with

sudo tar -xf stlink_udev_rule.tar.bz2 -C /etc/udev/rules.d

I have attched the devrules file and you put it in a folder called “stlink” in your Home directory to use the above command.

The dev rules for the “stlink and the “qstlink2” methods are the same I beleive.

I like “qstlink2” because it has a GUI where as “stlink” methed doesn’t and is run from the terminal.

I have not yet learned how to setup the debuging system but that is next on my list.

Then you connect your board and launch qstlink2 either by the icon or in a Terminal and you are good to go to program the board.

Unlike stlink, qstlink2 will only except a .bin file, but if your program compiles fine then the .bin file will be produced.

More to come!!

jer :-)

P.S. The file that I added got added twice by mistake and I couldn’t figure out how to delete one copy.
Your added files don’t show up when you edit the post.

Thank you very much ... always good to know what works :-) ... at the moment my problem is that I only get a Debug version but no Release version. Guess I’ll have to set the Release stuff by hand later ... got my own blinky working ... try to get the LCD working, but I find that they have done the same bad thing I always find - combined everything with everything ... The LCD needs the DMA and the memory controller (I only wanted to send some color patterns, but noooo ... you need the whole enchilada including fonts and SPI(OK, that’s clear) and so on) ...

So at the moment I always have 20 missing symbols ... I add files and have another 20 missing symbols. I only wanted to send some data to the LCD but it is all interconnected. And everything you add has to be initialized, can’t just add the SDRAM because that’s just what the compiler wants. The problem with this is that instead of a nice small litte test I will end up with an incredible behemoth of a program which will be a pig to debug ... not what I wanted to achieve. Modularity only on first glance. Of course I could go and cut the ties of that stuff but that’s exactly what I should not do ... manually change the underlying lib files. It should be a platform which I build upon - not tweak ...

The other thing buging me right now is to find out what is included in the compilation and what is visible from where. I find it annoying that Eclipse builds its own resource tree which looks like the file system but you can’t just add a file to a directory and it shows up in that tree (not even after refresh) ... so you import stuff from the file system into that Eclipse tree. But of course this logic is not used where you specify the incluse directories of the build ... there you give real file paths ... but there again visibility from one file to the next is not the same. I believe that there should be a single logic over all and frankly I don’t see why the file system couldn’b be that logic - as it used to be for decades. People seem to think that added abstraction layers is per definition a good thing. But they may also become obfuscation layers in my opinion.

Yeah, sorry again, this STM stuff brings out the worst in me, I’m afraid :-) ...

Thank you again for writing what you did to get going.

I am glad you got a Blinky program to work!!!

I think I know what you mean all of this stuff is a bit confusing to me as well, but in time I will figure it out.

Here is another Blinky program that is written a little differently but it flashes both the Red and Green LEDS on PG13 & PG14.

It took me a while to figure this one out as well.

In this version I followed the same steps only I just copy pasted the file as I had found it into the created blank Blinky project and it didn’t work and it should have.

It wasn’t until I commented out lines 2, 5 and 6 that I got it to compile correctly.

Again the value for “i” (2500000) controls the Binky rate in line 25.

Here is the “main.c” file as I have it working.

I hope this helps!! wink

jer :-)


One note I wanted to say about installing Eclipse in Linux is that you don’t have to install anything really.

You just create a folder called Eclipse and download the file to there and extract it there.

You must have however have to have at least JRE7 installed (Java) and then you get into the Eclipse folder and find the Eclipse executable and right click on it and select properties and make sure it is set as executable.

Then it will start when you click or double click (depending on your settings) on the Eclipse executable and it will start everytime.

I am not going to go into how to make a luancher as there are plenty of tutorials on the web for whatever your OS may happen to be.

jer :-)


Okay assuming that you have Eclipse and the Worbench for STM32 and also a programmer link working via Qstlink2 or whatever version of Stlink you need for your board it is time to get our Very First Blinky project underway!!!!

First when starting Eclipse you have to select a workspace for this i will chose mydemo.
So in the workspace box you should have “/home/(yourname)/workspace/mydemo” and hit okay.

Next select FIle at the top left corner and then “New” and click on “Project”.
In the “Selcet a wizard” menu select “C/C++” and click on “C Project” and then click on “Next”.

In he next menu “C Project” you put in your project name in our case “Blinky” then go to the Project type box and select “Executable” then highlight “Ac6 STM32 MCU Project” and your tool chain should also be highlighted as “Ac6 STM32 MCU GCC” and then click “Next”.

The next menu should be “Select Configurations” and see that both “Debug” and “Release or both checked and the click on “Next”.

This next menu is “MCU Configuration” and here you set your MCU type and board that you are using, in this case I select for “Series: STM32F4” and “Board: STM32F429I-DISCO” then click “Next”.

This next page is called “Project Firmware configuration” fris ther are two options the “StdPeriph” or the “Cube HAL” when you click on either one of these for the first time you will have to wait for them to download and install themselves.
In this menu we want to select “Standard Peripheral Library” and also selct “Extract all firmware in a seperate folder” and click on “Finish”

Congratulations of have just set up a blank C Project with all of the tools needed for this Project named “Blinky” !!!

Now to add the Program !!!

jer :-)


I have inculded the blinky file that I found in it’s entirety.

I don’t remeber where I found but i am sure there are no copy right issues since it is a very simple LED bliky and that is it.

I think I got it from Github or form some tutorial page somewhere.

The first one I tried to use was exactly like this one but it was missing the top part of the listing, and that is the 1 millisecond delay routine so the program kept giving me errors and my build would fail.

So, Let us pay attention to detail here!!
There are fews ways you can enter this code in to our IDE.

First click on the arrow next to “blinky” in the project manager and the the arrow next to SRC (for source code).

Double click on “main.c” this is our main program and it will open up to be displayed in the Ecilpse IDE.

By using the the “main.c” file in the ‘blinky ffolder” I have supplied below you can ethier copy past the “main.c” from that folder into the “Project Explorer” on the left or you can open up the “main.c” in an editor lik Gedit copy paste just to script in to the IDE itself.

The only difference is the when you copy paste replace the main.c is that the line #include “stm32f429i_discovery.h” won’t be there and that is okay for this example as it is not needed for the program.

So just copy paste and replace the “main.c” so that you can follow along since we have to make simple modification in order to make this work on our board.

I don’t know exactly wich discovery board this was written for but the GPIO port is set to D and in this program and we have to chage it for G port.

So for every line that shows GPIOD we have to change it to GPIOG.
If you have done everything exactly as I have it the lines that need to be changed are lines 22, Line 25 and line 29, all of them must have a G in place of the D.

Line 28 is our value of the Blinky rate and is currently set to 500milliseconds or .5 seconds.
You can change this value to a different rate to verify that everything is working correctly.

Our target LED is LED3 and it is a green hooked to PG13.

I could only include the main.c file , but that is all we need anyhow.

Now it is time to build our Blinky project and up load it to our board.

Jer :-)


To build our project first we have to select “Project” in the top toolbar and then “Build Configurations” and “Set Active” either ” 1 Debug” or ” 2 Release” and this where our “blinky.bin” file will be created in the “Project Explorer” tree.

Then got to “Project ” and “Build All” and wait for it to complie !!! :-D

Then use Qstlink2 or stlink to upload to your board.

Like I said I haven’t learned to setup the debugger yet but htis should get you going.

but the .bin file will be in /home/(your name)/workspace/mydemo/bnliky/ (debug or release) whatever you had it set for.

If you want you can change the blink rate in line 28 like I had explained, and then save all and select “Project” then “Clean” and “Build All” again and upload the .bin file to your board again and see the changes.

You may need to reset the “1 Debug” or “2 Release ” options again once you clean the project or else it won’t create the .bin file.

And that is it!!!
Pretty simple!!
Good luck!!!
And, If you have any questions feel free to ask and I will do my best to help. wink

Cheers!!!! :-D

jer :-)