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


C++ in-file assembly

I’m trying to migrate from Keil to SW4STM32 so I don’t have to drag along a Windows box just to debug my projects in an Embedded class. I made a new C++ project configured for an STM32F446 Nucleo with no HAL and brought in an existing main.cpp from my last assignment. I didn’t worry too much about the assembly causing complaints in the IDE because it caused complaints before and worked. Now it doesn’t my __asm function is full of errors and doesn’t even seem to get sent to the assembler. I found nothing on in C++ assembly in the docs so if the syntax is slightly different or if I was just being given some slack previously I don’t know. What don’t I know?

__asm int my_sqrt(int x){
PUSH {r4, r5}// push callee stored register
MOV r2, #0// a = 0
MOV r3, #0x0000b504//b = square root of largest possible argument(
MOV r1, #-1// c = -1 (a value we won’t encounter anaturally so equality fails to start)
my_sqrt_loop
CPY r4, r1// c_old

France

Hi,

Yes the syntax is quite different between Keil and System Workbench for STM32, which uses teh GCC compiler. You should look at the GCC dodumentation to learn how to write assembly language functions in C/C++; the documentation is freely available on Internet: just Google “GCC manual”.

Another alternative would be to craete a “.s” file with your assembly code, but in all cases teh ASM syntax has to be the GNU assembler syntax, not the Keil one...

Bernard (Ac6)


It took some finagling but I got it to work. Some hints for someone who comes in later:
Your in and out registers for your algorithm should be aliases like $[[par0]] $[[return]] (those should only be one set of brackets per but the forum software is trying to make them links) which you will define and map to variables in the return and parameter constraints of the asm block.
Even if you stack and unstack your temp registers, still put them in the “clobber” so GCC doesn’t choose to try to pass your parameters in on them.
Remember the order is code-return-parameters-clobber if you mix up parameter and return GCC will happily overwrite your input with your output variable, and do it by reference because why not.
If you’re porting from an assembly subroutine for the love of God, remove your “BX lr” first. Just return in your wrapping function to make life easier.
Despite what everything I read says, you can use plain old r1, r2, r3, etc. instead of %1, %2, %3.
Ignore the LDP documentation: it’s very x86 oriented and may confuse you if you aren’t that familiar. http://www.ethernut.de/en/documents/arm-inline-asm.htmlQuestion seems much better for learning instead of quick reference.