U
U
unk15002020-02-12 09:25:53
Microcontrollers
unk1500, 2020-02-12 09:25:53

How to stop writing in Asm and start using C++ for STM32?

The essence of the problem is that I inherited a fairly large software archive in Asm for microcontrollers of the AVR8 family. In the future, the struggle for microseconds led us to migrate to STM32 using the same assembler. Firstly, the specifics of the work implies a reduction in the execution time of the main code to a minimum, and secondly, the assembler is subjectively clearer and closer to me. At the moment, there are more and more tasks, the logic becomes more and more confusing, it becomes more and more difficult to maintain the overgrown code.

I would like to hope that a smooth transition to C, C ++ and the continued use of RTOS and pieces of assembly code will change the situation, but this is where the main problem arises. At the moment, ST suggests using CubeIDE for development using HAL. In addition, there are StdPeriph, CMSIS, and, I suspect, a whole bunch of other libraries (QnA offered LibOpenCM3 two years ago, for example). What to choose in this situation? I want both fast code, and convenient management of a bunch of events and interrupts, and readability.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander, 2020-02-20
@Fox_Alex

If there are too many "bottlenecks" - perhaps you should not waste time on optimization and counting cycles, but take an FPGA or SoC and make special peripherals for the task? And in the core or an external controller, you can already twist algorithms that do not require such a rigid reference to real time. Describe the problem in more detail, maybe I will tell you how to solve it.

V
Vladimir Korotenko, 2020-02-12
@firedragon

Select profiler and in-circuit debugging.
Based on these metrics, you will rewrite problematic code sections in ASM
. And by the way, C ++ for a microcontroller, especially with time-critical code sections, is unnecessary.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question