acados on ARM Cortex-M7 microcontroller

Dear acados developers,

I am attempting to run acados on a STM32F767 Nucleo-144 microcontroller. It has an ARM Cortex-M7 processor clocked at 246 MHz, with 512 kB SRAM and 2 MB flash memory. To compile acados I use the gcc-none-eabi compiler as a part of the MCU’s toolchain. The source codes are compiled on a x64 based computer running Linux, and acados with its python templates works fine here.

My hope is to use the source codes generated via python (c_generated_code), modify it appropriately and compile using gcc-none-eabi for the target microcontroller. However, here i run into two issues:

  • First, I would like to ask if it is possible to run acados without the presence of an OS, which is the case of my MCU. When executing acados from the c_generated_codeobtained from the python interface, I encountered a problem that the acados library needs to be compiled in .so format, and the path to this file needs to be added in the system variable $LD_LIBRARY_PATH. Therefore, I would like to know how to solve this on a microcontroller with no OS, which shall run the main application as one firmware.

  • Second, I have recently read on this forum that there is some problem with 32-bit processors: ACADOS on 32-bit AURIX™ Microcontroller based on TriCore Based on the discussion or the Issue section, I am not quite sure whether such implementation is possible or not; the opinions seem to differ. Therefore, I would like to ask if it is possible to compile acados on ARM Cortex-M7 type controller, which is also 32bit.

Thank you in advance,

Dominik

Hello, I am very interested in this issue as well! Can anyone provide some help on this, please?

1 Like

Hi,

Regarding 32-Bit architectures: Unfortunately, I didn’t have time to look into this again since I opened this issue:

Unfortunately, I also don’t have experience with this kind of hardware and how linking works there.
I am not sure what you have, if there is no OS.
In Linux, you could also put the libraries in /lib.
Did you previously link some libraries on that hardware?

Sorry to be of little help here…

Best,
Jonathan

Please see Working example for STM32H7 (Cortex-M7, 32-bit)

Dear @mindthomas ,

thank you for your reply!

I have been attempting to run acados on an STM MCU, namely STM32F767ZI, for a while now. You replied to my question by sharing your thread addressing basically the same issue. I studied it and cloned your repository. I chaned the STM32H743ZITX_FLASH.ld file for my particular board, and compiled the source code. It was executed correctly, however, when trying to debug the program, the STMcubeIDE crashes. Could you, please, give me a hint on what the problem is or could be?

Also, I would like to ask which MCU would you recommend as most suitable tu run acados from the performance point of view, since I noticed not exactly the fastest execution times within your real-time implementation. My aforementioned MCU is even less powerful, so I assume its computational performance will not be sufficient. FYI, I am attempting to execute embedded NMPC of an inverted pendulum system.

I would appreciate your help a lot.

Best,

Dominik

@dominik Crashing of the IDE sounds unrelated to the code itself. Have you tried an older version of the IDE? The version I used for testing was 1.4.0.

Please note that you would most likely have to update both the Linker file, the Startup file and potentially also the CPU clock configuration if you are changing the processor.

I would generally advice against running acados on microcontrollers/microprocessors. My work here was mainly done as a proof-of-concept to show that it can’t be done although it is not really practical. Both due to frequency limitations and especially memory limitations it is not practical and in many cases nor feasible to run acados on a microcontroller.
If you are still convinced that you want to run acados on a microprocessor you have to ensure the following three things:

  1. That you have sufficient memory, i.e. at least 512 KB of SRAM
  2. That the processor has double-precision floating point acceleration
  3. That the processor can run at a decent speed, i.e. anything below 300 MHz is not really worth a try.

What closed-loop rate are you hoping to achieve? And how many number of stages in the time horizon of the MPC would satisfy your requirements?
In my case I had 20 stages and was also solving an NMPC problem of an inverted pendulum.