Skip to main content
Visitor II
May 21, 2024
Question

Export STM32CubeMX Project to CMake

  • May 21, 2024
  • 1 reply
  • 1566 views

Hi, 

i wanted to export this Project:
https://github.com/mirzafahad/nucleo_stm32f429zi_lwip_examples/tree/master/UDP_Echo_Client

to CMake, so i can import it via the STM32 VSCode extension. 

I was following this short Video: https://www.youtube.com/watch?v=DDVdq47Dd94

Unfortunately when i click on "GENERATE CODE", most of the code written in main.c is lost. How can i prevent this?

Thanks for any help!

    This topic has been closed for replies.

    1 reply

    Graduate II
    May 21, 2024

    "Unfortunately when i click on "GENERATE CODE", most of the code written in main.c is lost. How can i prevent this?"
    Only write code in user code sections "USER CODE BEGIN x" and "USER CODE END x". Sometimes it can be tricky if you want to change some code outside of these sections, but you can use pre-processor tricks to solve that. Let me know how it works out.