Add components

Jorgen
Posts: 51
Joined: Fri Dec 09, 2022 11:39 am

Add components

Postby Jorgen » Wed Mar 15, 2023 9:48 am

Dear all,

I am using Visual Studio Code with ESP-IDF and nothing else.
I start a new project by clicking on View->Command palette -> ESP-IDF New Project. Then a form appears, and I fill in the name of the project, the folder, the version of ESP32 chip, the com connection, I add some components and finally hit the button to create the new project.

My first question is: How do I add components, after I have created the new project?

I have looked for a command for that, but I have not found one.

My second question is: how do I stop a running program on the ESP32?

I can of course replace the running program with another, but I am looking for a simple way to stop the execution on the ESP32 from within the ESP-IDF.

Regards,
Jorgen

MicroController
Posts: 1710
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: Add components

Postby MicroController » Thu Mar 16, 2023 12:44 am

How do I add components, after I have created the new project?
You add components by declaring them as dependencies ("REQUIRES") in your application's CMakeLists.txt, see https://docs.espressif.com/projects/esp ... quirements
how do I stop a running program on the ESP32?
You don't. Microcontrollers run their program in an endless loop as long as power is supplied. Also, the ESPs run on FreeRTOS, i.e. usually there are multiple concurrent tasks running at the same time, all of them will need to stop to actually be executing "nothing".
If you feel that during testing you actually want to ultimately end execution of a task, you can call vTaskDelete( NULL ); from within that task. If all your tasks do that there will be only the OS's idle task left running, not doing anything until the next reset or power cycle of the chip.
One word of caution: A task should always only "delete" itself, at a point where the task has released all resources it may have been holding (heap memory, locks,...). Killing any other task than oneself is almost guaranteed to cause hard to debug, non-deterministic problems.

Jorgen
Posts: 51
Joined: Fri Dec 09, 2022 11:39 am

Re: Add components

Postby Jorgen » Thu Mar 16, 2023 9:22 am

Thank you for the replies. Sorry, I have not expressed myself clearly.

When I look for a way to add components after having created the project, I look for a command to add components into the component folder of the project. When I created the project, I included the components, which I thought would be sufficient from the esp-idf-lib and they all got copied automatically from the esp-idf-lib into a folder named components within the project folder, nice and easy. Later, I discovered that I needed to add a few more from that library. My question is how to do that. Is it sufficient to copy a component from esp-idf-lib and paste it into the component folder of my project, or do I have to set something somewhere as well? I prefer not to include the complete library, but only the components that I actually need.

On stopping the execution I was looking for something similar to running the execution within a debugger as it is possible in the Microchip MPLAB. That opens up for single stepping for example.

Regards,
Jorgen

Who is online

Users browsing this forum: Baidu [Spider], BipinDangwal, Google [Bot], MicroController, psparodi and 118 guests