Page 1 of 1

Cubemx Sw4stm32 question

Posted: Tue Feb 11, 2020 3:21 am
by sheepdoll
This may be a bit off subject apart from the use of C++

So I upgraded my system and everything seems to run. But I have a glich today.
I wanted to create a C++ program using CubeMx 5.5.0 and sw4stm32 1.17.0. On OSX 10.15.3 (Catalina) Everything worked until the linker stage.

For some reason there is no *.ld file in the project.

I tried searching online as this is a pretty serious glitch. There are a few hits for older versions that either have no answer or were closed/solved with a version update.

The best I can figure out for a workaround is to create an AC6 project, which will create a linker script. Then one has to smash this into eclipse in the Properties --> .. "settings" where the -T option of the linker is "../" And change it to "../LinkerScript.ld/

I really do not want to create yet another user login (for half dead forums.) So I thought I might ask here. There is a rather nice mechanism for converting the cubeMX project to C++ which then opens up the direct use of the Arduino libraries in an epicurean way.

I have been working on a project written in IAR for the Atmel 32UC3 which is a 32 bit AVR. The code is a bastardized mess of ASF C mixed with C++ with random chunks of pure C. I got this mess to build and even run under studio 7. ASF is really not C++ friendly at all. I have not been much of a C++ user so never noticed that there is an option to convert a STM project in sw4stm32 to C++. Looks like it has been around for a while. There is also a rather nice (but older) set of C++ libraries called Stm32Plus, that has classes for the hd44780 LCD and 83848 PHY.

Re: Cubemx Sw4stm32 question

Posted: Tue Feb 11, 2020 5:03 am
by fpiSTM
Generating a SW4STM32 project works fine but in your case you select another "Toolchain/IDE" ? Right?
And in this case the linker script is not generated?

Re: Cubemx Sw4stm32 question

Posted: Tue Feb 11, 2020 5:29 am
by sheepdoll
I only have sw4stm32 on this mac. Have not tried any of the other toolchains.
The sw4stm32 is not generating the linker script

Re: Cubemx Sw4stm32 question

Posted: Tue Feb 11, 2020 6:38 am
by fpiSTM
I've started from a fresh install under windows so maybe why it works.
I've just tested on Linux and it works fine also maybe a regression on MAC.
You should try to start from a fresh install (I already met issue after "udpate" :roll: )

Re: Cubemx Sw4stm32 question

Posted: Tue Feb 11, 2020 11:31 am
by zoomx
Maybe the linker is a 32bit app? Last OSX doesn't support 32 bit app anymore.

Re: Cubemx Sw4stm32 question

Posted: Tue Feb 11, 2020 6:54 pm
by sheepdoll
zoomx wrote:
Tue Feb 11, 2020 11:31 am
Maybe the linker is a 32bit app? Last OSX doesn't support 32 bit app anymore.
Linker is fine. Both apps are written in JAVA so the 32 bit restriction is not the issue. Sw4stm32 projects created in eclipse work fine. Older CubeMX projects which already have a linker script work fine.

I have not had the time to attempt a re-install the CubeMx. I had to use the instructions in the other thread on this site to install the java program from the command line disabling gatekeeper.

I do notice a warning when I create a board manager project which says that "/Applications/STMicroelectronics/ is read only."

I tried several different boards, with the same result, with the name of the board template marked 'read only'

OSX 10.15 and above have a read only root partition. I think Apps are now read only to prevent malware injections. With the move to SSD drives and boot partitions the less writes the better. (I was reading that one should not install 10.15 on a spinning HDD boot partition. 10.15 can not even boot from a HFS+ partition. APFS is optimized for flash. I suspect eventually it will all be iOS.)

It could be that cubeMx java code is attempting to modify this *.ioc template. The arduino IDE works in a similar way where the app is a wrapper to the java code. Att one time I used a symbolic link to the Arduino IDE toolchain from inside the app package. Years ago (has it really almost been a decade?) I wrote a *.ioc parser in postscript that would create a stm32duino arduino project using HAL. (as a proof of concept.)

Actually that is probably where the stmduino sketch should be created by cubemx rather than in the arduino.ide board installer. Both programs are java so they could work together keeping the local data in the ~/library/application support directory (or equivelent on other operating systems.)

I suppose one could modify the app (although it would mess up the developer signature signing) to hard link 'Applications/STMicroelectronics/' to a writable directory in ~/library.

I really do not have the time to debug this. For now I will just have to use the workaround and install the linker script manually.

Another failing in the STM ecosystem is that STM32Cube is created as a directory with a folder called repository. This is where the firmware packages get unzipped to. It duplicates the same information dozens of times. One has to go in from time to time and remove the older folders (which can be re-installed from the zip or re downloaded.) sw4stm32 also downloads this same information into it's own folder tree. This means the ecosystem eats a lot of local HDD space when a lot of different products are being evaluated. Some of this information in these firmware packages is over a decade old.

Re: Cubemx Sw4stm32 question

Posted: Tue Feb 11, 2020 7:14 pm
by fpiSTM
I will raise issue internally. If I get any feedback I will share here.
Anyway open an topic in ST community should be fine also.

Re: Cubemx Sw4stm32 question

Posted: Tue Feb 11, 2020 9:15 pm
by sheepdoll
I never created an account in ST community -- to many accounts as it is ;)

For what it is worth, I installed the tools on my laptop which runs 10.13 (High Seirra.) and do not have the issue. So I think it has something to do with the write protection.