cancel
Showing results for 
Search instead for 
Did you mean: 

I want to use the STM32G474VET6 in a robotic application with 3 motors and a diff GPS. Can I program it in Assembly or do I use C? If the latter is Keil a good compiler?

KDIAS.2340
Associate II
 
49 REPLIES 49
berendi
Principal

You can program it in assembly or in C, or mix them as you like, even within one function.

Keil is a very good compiler if you can afford it, or you are confident that the code size will never reach 32 kilobytes. Otherwise, STM32CubeIDE or Eclipse CDT with the GNU-MCU-Eclipse plugin are good choices. All of them support both C and assembly.

I assume the latter 2 are free. How to get them? Thanks

There were links, click them

S.Ma
Principal

Embedded C compilers are good enough that 98% of the time you won't need to down to ASM level.

When knowing how the compiler works and knowing how the core function helps you to write C style with predictable ASM code generation.

And you shall have 20% more flash that needed to disable the compiler optimisations so you can easily put breakpoint and look at human readable ASM code in the debug window when necessary.

The only ASM instruction I use is NOP to place breakpoint hooks (for example in switch case places) and SW delays, and to temporarily disable interrupt (save the interrrupt level in stack, disable, then pop it.

DMB, DSB, WFI, CLZ, REV, REV16, REVSH, RBIT are also quite necessary in non-trivial projects.

KDIAS.2340
Associate II

Just wonder - is there sample code already available to do this - it is trivial i.e. controls 3 motors only. which is better for a beginner ~STM32CubeIDE or ECLIPSE CDT?

Most places engage an engineer or developer to code the trivial and assembler based stuff.. I use Google to mine the interwebs and git.

CubeIDE is presumably where all the resources are being thrown, forum traffic indicates a mixed level of success, as the teething issues are resolved, and projects/importation issues are addressed.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
KDIAS.2340
Associate II

Doesn't answer my question i.e. is there sample code in the public domain that I can modify and use in my application?

Also one of the best free options is EmBitz, which is based on Code::Blocks and GCC toolchain. It can be set up for any STM32 in a similar way to this.