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 two short videos (registration required) highlighting:

System Workbench for STM32


SW4STM32 or CubeMX to init STM32 device

I am a starter for STM32 device and I understand CubeMx can generate init C codes and project with main() function.

I am using SW4STM32 IDE as development tools.
If I create a SW4STM32 project including HAL which also genrates functions for init, but not in details as CubeMX does(such as clock generating), do I still can use the init codes generated by CubeMX for SW4STM32 project or I need to use the HAL functions to init device manually?

France

Currently CubMX is not yet fully integrated with System Workbench for STM32; in a future version of CubeMX it will be possible to generate directly System Workbench projects.

In the meantime you can just copy a few files from th eCubeMX generated files to your System Workbench “src” folder:
main.c - the main program generated by CubeMX (includes most initializations)
stm32fyxx_hal_msp.c - low-level core initialization (mainly interrupt-related)
stm32fyxx_it.c - HAL interrupt handlers (mainly the SysTick interrupt)

This should be enough to initialize your board correctly.

Bernard


I see, thanks.

Junbo


HI, Bernard:

If I will use the init codes generated by CubeMX for SW4STM32 project, which option is best for SW4STM32 project, Empty, Cube Hal or Standard Lib?

Thanks.

Junbo

France

Hi Junbo
Of course, you must create your project using the HAL firmware, so that SW4STM32 will create and reference the library project corresponding to the HAL firmware for your board.
Bernard

Hi, Bernard:

“Of course, you must create your project using the HAL firmware”, what is project you are pointing to, CubeMX or SW4STM32?
The project created in CubeMX(.ioc) is not able to import by SW4STM32.

Besides, when to create SW4STM32 project for STM32F103C, the Cube HAL option is disabled.


Junbo


Hi,

I wanted to jump on this thread because I feel like I’m missing something important and hope someone can help me out:

I downloaded STM32CubeMX and spent a while with its fancy and actually helpful GUI setting up my particular environment: chip, timers, clock, peripherals, and so on. I selected “SW4STM32” as my IDE, and hit Generate Code and it generated a significant amount of stuff: 23MB of stuff to be exact; 546 files in 71 folders of C code, header files, eclipse metatdata, etc. This got me pretty excited.

But when I go to System Workbench, I can’t figure out how to cleanly pull it in. Things I’ve tried:

1) Creating a new workspace in the folder that CubeMX created
2) Creating a new project with Cube HAL
3) Creating a new project with no init code, then importing the CubeMX directory as an existing project

I feel like #3 got me the closest, but what it did is created a directory structure, claimed to import the source files (but didn’t), and I get a source tree that looks complete except that none of the files exist (in the Project Explorer I can see all of the files, each with a little exclamation point because the directory exists but is empty), and the directory layout is different than what CubeMX actually created. There’s also a list of Includes that almost, but doesn’t quite, correspond to what System Workbench would have created if it actually copied the source files over (the overall directory structure looks right except that it’s missing a chunk out of the middle; e.g. a directory says “D:/sw/sw4stm32/Drivers/STM32F4xx_HAL_Driver/Inc” but should be “D:/sw/sw4stm32/workspace/cubemx project name/Drivers/STM32F4xx_HAL_Driver/Inc”).

It’s incredibly frustrating that it gets this close without actually working. I feel like given half a day of no distractions, I could manually copy things and correct the locations of all of these files and directories but I’m hoping that I just failed at googling this and there’s really a simple explanation as to how to make the two applications play nice with each other. The fact that CubeMX lists SW4STM32 as a compatible development environment leads me to believe that it’s possible I’m just not following the instructions somewhere.


Any hints?

Thanks,
--
Elliott


France

Hi Elliott,

In fact the right way to go should be a 4th possibilities:

  1. Open System Workbench and choose a suitable workspace (could be empty but should probably be the directory in which CubeMX generated its code)
  2. Import the project created by CubeMX:
    • Right click in the project explorer >> “Import...”
    • Select “General” >> “Existing Projects into Workspace”
    • Browse to the directory where CubeMX generate code
    • Here you should not select Copy projects into workspace
      • If you do, the source code will be moved and relative paths will no more be correct


Then you should have a working project

Bernard

Hi Bernard,

Thanks for your quick reply. This is similar to things I’ve tried already, and didn’t work. My steps were:

1) Create a new, empty Eclipse workspace
2) Place my CubeMX .ioc file in a subdirectory of the workspace, run CubeMX, generate all files
3) Run System Workbench with this workspace, project->import, General->Existing, select the CubeMX directory
4) System Workbench claims to import everything

Result:

There’s a directory tree that on its surface looks good, but none of the files exist. Example: off the root directory, there’s a Middlewares/USB_Device_Library directory with four .c files. In the project tree, each of these files has a little exclamation point next to it. If I double click one of the files, I get the message: “Error retrieving content description for resource ‘/Board Configuration/Middlewares/USB_Device_Library/usbd_cdc.c’.
System Workbench created a directory ‘Board Configuration/Middlewares/USB_Device_Library’ but didn’t put any files in it. The file is actually in ‘CubeMX/Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Src/usbd_cdc.c’.

If I copy the file to where System Workbench appears to think it is, I still get the same message. At first glance it appears that System Workbench is improperly adding a leading ‘/’ to the filename, but if I look in the .project file at the root of the project directory, I see (xml tags changed so it posts):
(link)
(name)Middlewares/USB_Device_Library/usbd_cdc.c(/name)
(type)1(/type)
(location)PARENT-2-PROJECT_LOC/Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Src/usbd_cdc.c(/location)
(/link)
... which, assuming that PARENT-2-PROJECT_LOC is correct, would be the correct file location. Not exactly sure where PARENT-2-PROJECT_LOC is defined.


If I right click the file in the Project Explorer and select properties, I can see it is a linked file; the Path is ‘/Board Configuration/Middlewares/USB_Device_Library/usbd_cdc.c’ and Location is ‘PROJECT_LOC....\Middlewares\ST\STM32_USB_Device_Library\Class\CDC\Src\usbd_cdc.c’ and Resolved location is ‘D:\sw\sw4stm32\Middlewares\ST\STM32_USB_Device_Library\Class\CDC\Src\usbd_cdc.c - (does not exist)’

So clearly this is a problem; PROJECT_LOC.... is outside of the workspace.

If I look at poperties for the project, I see under Linked Resources that there is a PROJECT_LOC path, under Path Variables, that accurately reflects the project location. Interestingly, what this means is that the linked path is incorrect because PROJECT_LOC....\Middlewares... is not correct - it should actually be PROJECT_LOC..\CubeMX\Middlewares ... so that seems fixable. Fortunately there’s a Linked Resources tab with a convenient list of all of the invalidly linked files. I’m going to try to fix all of them and see what happens. Hopefully it’s just an import glitch and everything will be fine once I correct these. I’ll also fix the Include paths, which are similarly incorrect, and maybe I can compile something. I’ll post an update if that works.


Hi, Bernard:

I tried your way to import project from CubMx to SW4STM32, but the project generated by CubMX is not capable for SW4STM32 to import.
I tried all there project options in CubMX, none of them are working. You will not be able to see any project in SW4STM32 project import Windows. The only one is TrueSTUDIO configuration, but file generated by CubMx not importing to SW4STM32.


Junbo


France

Hi Elliott,

I just had time to look at the way CubeMX generates System Workbench projects; we are discussing the way to improve this, but, in the meantime, it is possible to import the code generated by CubeMX under System Workbench, although some features of System Workbench (like the integration with source code control) will not work as seemlessly as usual. We will provide a migration tool later if needed.

There is in fact two possibilities, that all imply that Eclipse will work directly on the files generated by CubeMX, in the folder where there were generated (so do not delete them once integrated in System Workbench):

  1. Import the project in an existing workspace; in this cas you should follow the standard procedure, but ensure you do not check “Copy projects into workspace”
  2. Use the folder where CubeMX generated its code (the folder that contains Application, Drivers, Xxxx Configuration...) as your workspace and Import... the project from this folder (the “Browse” button in the Import... dialog should automatically open the proper folder)

In both cases you should then be able to compile your project as usual, but be careful:

  • You may have to tailor the include search path for your project:
    • If you create new source files (e.g. usermain.c and usermain.h in the Application/User folder), these will be created in the project itself, and will not be side-by-side with the CubeMX-generated files
    • If you modify a CubeMX-generated file (e.g. main.c, to add an ‘#include usermain.h”’ line), it will be modified in its original location.
    • Then your project will no more compile, as usermain.h, although it looks like it is, is not in the same folder than main.c; to correct that you must add Application/User to the list of include file directories (project >> Properties >> C/C++ General >> Paths and Symbols)
  • Source code management
    • You can use GIT for source code management directly from Eclipse, however
      • When creating your local directopry you must not click the “Use or create repository in parent folder of project” but rather place it in the folder generated by CubeMX (the one that contains teh Application and Drivers subfolders)
      • Several folders in the project view will remain marked as “non-versionned” (with a blue question mark) as long as you do not create a local file in them (git do not version directories, just files).
    • You cannot directly use SVN for source code management of your project
      • You should first manually import the whole CubeMX-generated folder in your SVN repository (for example by using TortoiseSVN)
      • Then you may share your project from Eclipse, specifying as repository the root of your SVN repository (assuming you initially import everything in the trunk subfolder)

We apologize for the inconvenience; we are working with ST on a workaround to avoid these problems and smoothen your experience.

Hello dautrevaux,

The process I took yesterday is as you described, I think - start with an existing (empty, in my case) workspace, generate files in a subdirectory of that workspace, create a new project in the workspace, and import the files without copying. I did not check the “copy projects” checkbox because I may add some options later and want to be able to modify options in CubeMX.

System Workbench created a project tree:

Project Configuration
> Binaries
> Includes
>> C:/Ac6/.../stock includes
>> includes from CubeMX, incorrect paths as noted before
> Application
>> SW4STM32
>>> startup_stm32f427xx.s
>> user
>>> files from CubeMX e.g. adc.c, dma.c, tim.c; incorrect paths as noted before
> Debug
> Drivers
>>> CMSIS
>>>> system_stm32f4xx.c
>>> STM32F4xx_HAL_Driver
>>>> HAL files
> Middlewares
>> USB_Device_Library
>>>> USB files, e.g. usbd_cdc.c and usbd_core.c
> user
STM32F427IIHx_FLASH.ld


... The layout looks good, but each symbolic link had the same error, for example the file stm32f4xx_hal_i2c_ex.c:

Generated symlink: PROJECT_LOC..\..\Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_i2c_ex.c
Symlink should have been: PROJECT_LOC..\CubeMX\Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_i2c_ex.c

... for each symbolic link, the pathname had the same error. I went to the list of linked resources in the project configuration (I could have edited the .project file but did not feel comfortable doing that) and corrected that, and also made the same correction in the include paths, and now I am able to build the project.

Revision control comes next biggrin and then some more complex code but I’m able to build code that runs on the chip so I feel like this was the only major hitch.

Thanks!
--
Elliott


France

Hi Elliott,

No there is a small difference, that may make the difference, at least regarding how you present these:
You should

  1. Create a new workspace (empty folder named, for example, myWS
  2. Generate CubeMX code in a subdirectory of this folder (that is in myWS\myPROJECT)
  3. Open System Workbench for STM32, using myWSas workspace
    • The project explorer will be empty
  4. Import the CubeMX-generated project:
    • File >> Import...
    • Browse (should automatically select myWS)
    • it should show just one project, named “myPROJECT Configuration”, automatically selected
    • Click “Finish”

Now you have a working project; however there is a small potential problem: Your project is called “myPROJECT Configuration”, and a name with a space in it is, at least, a burden (especially on Linux but also on Windows). So you should probably:

  1. Rename the generated files
    • Right click on project >> Properties
    • C/C++ Build >> Settings >> Build Artifact
    • Suppress ” Configuration” from the artifact name
    • OK
  2. Do not rename your project
    • Eclipse seems to break all linked resources pointing to project-relative paths when the project is renamed...

Then you should have a working project that can be compiled correctly. However, the CubeMX-generated project do not include a board description with debug connection information: kind of MCU, debug probe, debug link. You thus can’t debug as simply as usually.

One solution may be to create a debug configuration then select your debug script manually by

  • Debug As >> Debug Configurations...
  • Create a Ac6 STM32 Debugging configuration
  • Choose your project and executable (if needed)
  • Select the Debugger tab
  • If there is a NO SCRIPT FOUND red error message (most surely currently) select the “Use local script” redio button
  • Provide a debug script by one of three means:
    1. Browse to your System Workbench install directory, then plugins\fr.ac6.mcu.debug_1.1.0.201503121050\resources\openocd\scripts\board and look for the script for your board (you may find also some st-specific scripts in st_board)
      • This is usually the way to use for a standard ST board (eval, disco or nucleo)
    2. Manually search for a close board in the directory above then manually copy it to your project main directory, then browse to it and select it
      • This is usually a good way to go for a custom board that is very close to an ST board (often an EVAL board), including the same debug interface
    3. Get a custom board debug script created when creating a project using your custom board (may be a no-firmware project with an empty main program)
      • You just have to copy the System Workbench-generated debug script in your project and browse to it
      • This is usually convenient if you define your own board, create a custom board in a System Workbench-generated test project and want to reuse it in your CubeMX-generated project

Once your configuration is working, you can launch it by using the small “bug” button in the top toolbar (either click it directly or use the small arrow on its right to see the last valid debug configurations used).

It’s not perfect, and a bit less practical then for System Workbench-created projects, but it should work without too much problems.

Please let me know if it works (or if you have other problems).

Bernard

Hi Bernard,

I didn’t go through the debug steps yet, but the project setup you described worked perfectly! I have a custom board so I’ll have to set up something for the debugger but right now I’m in a panicked rush to get a few basic things working (namely USB CDC) so I’m just using ST-LINK to program the board and try stuff.

Thanks,
--
Elliott


Hi, Bernard:

I did this importing CubMX configuration project to SW4STM32. However, there are some issues for this to prevent it for real operation.
First, there is only Debug mode for build configuration for SW4STM32. The Release mode is gone.
Second, the files linking for this imported SW4STM32 project is very eazy to broke if you edit any proporities of project, such as includeing path.

In real practice, you create the SW4STM32 project with Cube HAL option and copied/pasted init codes sub-dir \Src, and \Inc generated by CubeMX to SW4STM32 project. You don’t need to copy drivers from CubeMX to SW4STM32 because there are generated by SW4STM32 Cube HAL. They are the same drivers.

But I have a big problem to do this way because Cube HAL option is disabled for F1 family, such as stm32f103c8 for SW4STM32 project. It works for F0 family, such as stm32f091cc. How can I fix this issue to use Cube HAL drivers for F1 devices?

By the way, where is the local location for cube fw STM32Cube_FW_F0_V1.1.0 after SW4STM32 downloading?



Junbo

France

Hi Junbo,

To have HAL support for the F1 family you must use a recent version of System Workbench for STM32; the simplest way for that is to do an update of the IDE by selecting “Help >> Check for Updates...” and install all proposed updates.

Your way to go is probably the better way, but it is needing manual operations and may cause a few problems with middlewares. In any case you should probably create your project by checking to import the firmware “As sources” and not “As static external libraries” as, for some middlewares, you will need some configuration files that will be found in “Inc” to compile them successfully.

The downloaded firmwares are stored in %APPDATA%\Ac6\SW4STM32\firmwares that is, on Windows 7, something like C:\Users\%USERNAME%\AppData\Roaming\Ac6\SW4STM32\firmwares

Bernard


Thanks, Bernard.

I did “Help >> Check for Updates...”, but all updated items are for 32-bit Windows version.
I am using 64-bit bersion for Windows 7, so not sure whether or not to update.

Updating STM32CubeMX to version 4.7 allow me to generate SW4STM32 project and importing it to SW4STM32 with HAL functions.
This allow me to start software devlopment with HAL for F1 devices. But if I can enable Cube HAL inside SW4STM32 will be better.

The old version 4.6 of STM32CubeMX Check for Update is not working correctly because it said UP TODAY Version even there is a new version released.

By the way, what is the last version of SW4STM32 for 64-bit Windows OS.


Junbo

France

Hi Junbo,

When I said to make a “Help >> Check for Updates” it was of course on system Workbench for STM32, not STM32CubeMX (I do not even notice there was such a menu entry).

When updating (or installing) the only installable components (plugins) that are tagged Windows or Linux are the external (native) tools like compilers, debuggers...

On Windows, regardless of the running system or IDE version, only 32-bit versions of these are provided as there is usually nothing to earn at running a 64bit-compiled compiler: it will be bigger and will not run significantly faster. However the IDE will run better if running as a 64bit executable as it may manage its memory more efficiently.

Thus when updating a Windows version, you should update the components marked “for Windows 32 bits”. The component that should be updated is the “OpenSTM32 IDE” that should be at version 1.1.0.20150301252 (the last 8 figures are in fact a timestamp).

Bernard

Well, I’m still struggling.
I downloaded STMCUBE latest version. Unpacked the clean files sent from Luca Spelgatti, ran STMCUBE and told it to generate a project for the open stm tool chain.

It did that.
Then I went to STM32 and did an import. Browsed to the directory where I had generated the CUBE project, and selected that as a project.
Did a make.
2 errors
and the thing is stuck at 60%
make access denied
make waiting for unfinished job, and it has been sitting there like that for 10 minutes.

What gives?

I went into the zip file and deleted the headers for everything other than the F411 and have attached it to this post.
I’ll attach a second file to the next message. IT will have the headers with their path.
You should be able to rebuild it from there.

What I would hope could happen, is that someone can take this, compile it, get it to download into a F411 Nucleo board, connect to it with the debugger that is built into that board, and single step some code.
Then zip it back up and send it to me, I guess by attaching it to a post, or sending it to the email address that is associated with my account. I assume the moderators can do that. I don’t want to make that address public....

64 bit apps can use all of a systems memory. I have 8GB, so that means eclipse is able to run above 4GB, which can be more efficient on my system at times.
32 bit apps are stuck to the lower 4GB and as this space becomes crowded, Windows/OS X will start swapping and this leads to slower performance. I usually have some other 32 bit apps running on the system, so crowding can be an issue.
As the OS is 64 bits, that means that it lives in the upper regions of the 8GB space, thus not competing for memory space with apps. FWIW, when bit 63 is set, the system is working in Windows.


I followed Bernars instructions.
My STM32CubeMX STM32F4Discovery project imported, I deleted Configuration from the entry in Build Artifact, I copied the Debug script from the AC6 installation and put it in the same folder as the Linker Script, I told the Debug Configuration to create a new Debug for AC6, I manualy set the Debug Script to local and then I plugged in the board and clicked on Debug.

The STLink activity light changed from red to green to red to green repeatedly, indicating that OpenOCD and StLink and the USB driver were talking to the board and the previous code loaded into the STM32F4Discovery board was overwritten.

IT WORKS.

Now to write some code to learn about the STM32. Thank you folks for System Workbench and I look forward to continuous improvements such as a tighter inegration with STM32CubeMX.

By the by, where does thta nasty Configuration entry come from, STM32CubeMX, eclipse, or CDT?


I went through these steps
Debug As >> Debug Configurations...
Create a Ac6 STM32 Debugging configuration
Choose your project and executable (if needed)

It filled in things for me. and created a debug script.
At the bottom of the debug configuration command, there is a debug button. I really should not have to do this each time, so will need to know how to select this without doing this.

I hit debug and get an error.
‘Lauching project name has encountered a problem.
OpenOCD Script not found.

There is NO use local script radio button.
NOW WHAT?

Select the Debugger tab
If there is a NO SCRIPT FOUND red error message (most surely currently) select the “Use local script” redio button
Provide a debug script by one of three means:
Browse to your System Workbench install directory, then plugins\fr.ac6.mcu.debug_1.1.0.201503121050\resources\openocd\scripts\board and look for the script for your board (you may find also some st-specific scripts in st_board)
This is usually the way to use for a standard ST board (eval, disco or nucleo)
Manually search for a close board in the directory above then manually copy it to your project main directory, then browse to it and select it
This is usually a good way to go for a custom board that is very close to an ST board (often an EVAL board), including the same debug interface
Get a custom board debug script created when creating a project using your custom board (may be a no-firmware project with an empty main program)
You just have to copy the System Workbench-generated debug script in your project and browse to it
This is usually convenient if you define your own board, create a custom board in a System Workbench-generated test project and want to reuse it in your CubeMX-generated project


Found the local script option and navigated and selected the config as specified.
Now I got further, and
....
info this adapter does not support configurable speed.
libusb_open failed with LIBUSB_ERROR_NET_SUPPORTED
open failed
in procedure
init
ocd_bouncer
transport
init

“Launching project name has encountered a problem
Error with command gdb - -version

I am running a dell windows 8 64 bit with classic shell to make it look like windows 7.
A USB cable is connected to the STLINK debug interface.


When I expand the error it says cannot run program gdb launching failed

Hi,

I have download the “tem2_with_everything_HSE_8mhz fixed SHORTENED.zip (443.35 Kb)” file. The STM32CubeMX-generated code was for TrueSTUDIO and not System Workbench.

I did download the latest version of STM32CubeMX (v4.7.0), opened your project and change the Toolchain/IDE to SW4STM32 in the project settings. Then I’ve regenerated the code.

On System Workbench, I chosed the CubeMX project root directory as workspace, then imported the generated project.

To debug, I have found the debug script “nucleo-f411re.cfg” in the repertory “SystemWorkbench\plugins\fr.ac6.mcu.debug_1.1.0.201503121050\resources\openocd\scripts\st_board”. I’ve copied it into the project and select it as local script in the debug configuration.

My workspace is attached in http://dl.free.fr/k9pDN3ZlNQuestion. Run System Workbench with this fiolder as workspace. You should see your project.

Hope it will work and help you.

Regards,
Kevin


Page: 1/2  [Next]
1  2