Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions content/workshops/esp-idf-advanced/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Estimated time: 3 hours.

## Agenda

The workshop is structured into four parts. Here's the outline:
The workshop is divided into four parts. Here's the outline:

* Part 1: **Components**

Expand Down Expand Up @@ -134,4 +134,4 @@ Even if you complete all assignments successfully, you’ll still need to downlo

## Conclusion

You just arrived at the end of this workshop, congratulation! We hope it was a fruitful experience and the start of a longer journey. Thank you for following the advanced ESP-IDF workshop.
Congratulations! You just arrived at the end of this workshop. We hope it was a fruitful experience and the start of a longer journey. Thank you for following the advanced ESP-IDF workshop.
4 changes: 2 additions & 2 deletions content/workshops/esp-idf-advanced/assignment-1-1/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ summary: "Create the `alarm` component and refactor the code to use it. (Guided)

You will:

1. Run the example to check everything is working
2. Create a the `alarm` component
1. Run the example (to make sure that everything is working)
2. Create an `alarm` component
2. Add the component configuration

### Run the example
Expand Down
16 changes: 8 additions & 8 deletions content/workshops/esp-idf-advanced/assignment-1-2/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ showAuthor: false
summary: "Create a `cloud_manager` component and refactor the code to use it."
---

In this second part, you will separate the connection logic from the main function. The main advantage of this approach is that you could transparently change the connection type (e.g. to MQTTS or HTTP).
In this second part, we will separate the connection logic from the main function. The main advantage of this approach is that you could transparently change the connection type (e.g. to MQTTS or HTTP).

In this assignment, you will refactor the connection to Wi-Fi and MQTT code to fit into a new component.
In this assignment, we will refactor the connection to Wi-Fi and MQTT code to fit into a new component.

#### Assignment detail
#### Assignment details

You should create a `cloud_manager` component with the following methods

Expand All @@ -31,18 +31,18 @@ The following parameters should be set through `menuconfig`:
## Assignment steps outline

1. Create a new component and fill `cloud_manager.h`
* Add the suggested methods.<br>
* Add the suggested methods<br>
* Add an opaque declaration `typedef struct cloud_manager_t cloud_manager_t;`<br>
_Note: In `cloud_manager.h` you need to import just `esp_err.h`_
2. Fill `cloud_manager.c` <br>
* Implement `cloud_manager_t` as <br>
2. Fill `cloud_manager.c`<br>
* Implement `cloud_manager_t` as: <br>
```c
struct cloud_manager_t {
esp_mqtt_client_handle_t client;
esp_mqtt_client_config_t mqtt_cfg;
};
```
* In `cloud_manager_create` just return the initialized object
* In `cloud_manager_create` just return the initialized object.
* In `cloud_manager_connect` initialize everything. You can use the function `example_connect`.
3. Add the following to the `cloud_manager` component `CMakeList.txt`<br>
```bash
Expand Down Expand Up @@ -240,4 +240,4 @@ endmenu
You can find the whole solution project on the [assignment_1_2](https://github.com/FBEZ-docs-and-templates/devrel-advanced-workshop-code/tree/main/assignment_1_2) folder on the github repo.


> Next step: [assignment_1_3](../assignment-1-3/)
> Next step: [assignment 1.3](../assignment-1-3/)
17 changes: 9 additions & 8 deletions content/workshops/esp-idf-advanced/assignment-1-3/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ date: "2025-08-05"
series: ["WS00B"]
series_order: 5
showAuthor: false
summary: "Support multiple configuration via sdkconfigs"
summary: "Support multiple configurations via sdkconfigs"
---

In this assignment you will create two versions of `sdkconfig` (production and debug).
In this assignment, you will create two versions of `sdkconfig` (production and debug).
The only difference between the two is the logging: Debug will display all logs, while production has all the logs suppressed.

### Assignment Detail

You project must have the following configuration files
You project must have the following configuration files:

1. `sdkconfig.defaults`: containing the `esp32-c3` target
2. `sdkconfig.prod`: containing the logging suppression configuration (both app log and bootloader log)
Expand All @@ -39,7 +39,8 @@ The final project folder tree is

## Assignment steps

You will
We will:

1. Create the production sdkconfig version (guided)
2. Create a profile file (guided)
3. Create the debug sdkconfig version
Expand All @@ -58,11 +59,11 @@ To create the debug configuration, we first need to find the log configuration.

#### Create `sdkconfig.prod` file

The easiest way to find the configuration names we changed is to run the `save-defconfig` tool, which will generate a `sdkconfig.defaults` file with just all the changed parameter.
The easiest way to find the configuration names that we changed is to run the `save-defconfig` tool, which will generate a `sdkconfig.defaults` file with only the changed parameters.

* `ESP-IDF: Save Default Config File (save-defconfig)`

Looking at the new `sdkconfig.defaults` you see two new configurations appearing
Looking at the new `sdkconfig.defaults`, we can see two new configurations:

```bash
CONFIG_LOG_DEFAULT_LEVEL_NONE=y
Expand Down Expand Up @@ -98,7 +99,7 @@ To simplify the process we will create a _profile_ file.
-B build-production -DSDKCONFIG=build-production/sdkconfig -DSDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.prod"
```

You can now build the production version using
We can now build the production version using

```bash
idf.py @profiles/prod build
Expand Down Expand Up @@ -140,6 +141,6 @@ CONFIG_LOG_DEFAULT_LEVEL_INFO=y
</details>


You can find the whole solution project on the [assignment_1_3](https://github.com/FBEZ-docs-and-templates/devrel-advanced-workshop-code/tree/main/assignment_1_3) folder on the github repo.
You can find the whole solution project in the [assignment_1_3](https://github.com/FBEZ-docs-and-templates/devrel-advanced-workshop-code/tree/main/assignment_1_3) folder in the GitHub repo.

> Next step: [Lecture 2](../lecture-2/)
5 changes: 3 additions & 2 deletions content/workshops/esp-idf-advanced/assignment-2-1/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ In this assigment, we will decouple the alarm and temperature code by using the

## Assignment steps

You will:
We will:

1. Create the events<br>
* `TEMP_EVENT_BASE` with `temp_event_id`
* `ALARM_EVENT_BASE` with `alarm_event_id_t`
Expand Down Expand Up @@ -249,7 +250,7 @@ void app_main(void)

</details>

You can find the whole solution project on the [assignment_2_1](https://github.com/FBEZ-docs-and-templates/devrel-advanced-workshop-code/tree/main/assignment_2_1) folder on the github repo.
You can find the whole solution project in the [assignment_2_1](https://github.com/FBEZ-docs-and-templates/devrel-advanced-workshop-code/tree/main/assignment_2_1) folder in the GitHub repo.

## Conclusion

Expand Down
8 changes: 4 additions & 4 deletions content/workshops/esp-idf-advanced/assignment-2-2/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ In this assignment you'll extend the functionality from Assignment 2.1 by introd
### Assignment detail

* The code for detecting a GPIO press is provided below.
* You need to integrate the logic into the existing event loop
* Use the same `ALARM_EVENT_BASE` as the alarm trigger as before
* Create a `ALARM_EVENT_BUTTON` to differenciate it from the `ALARM_EVENT_CHECK`
* You need to integrate the logic into the existing event loop.
* Use the same `ALARM_EVENT_BASE` as the alarm trigger used before.
* Create a `ALARM_EVENT_BUTTON` to differenciate it from the `ALARM_EVENT_CHECK`.

{{< alert icon="lightbulb" iconColor="#179299" cardColor="#9cccce">}}
An alternative version for `esp_event_post` called `esp_event_isr_post` exists.
There is an alternative version for `esp_event_post` called `esp_event_isr_post`.
{{< /alert >}}

### Reading GPIO code
Expand Down
13 changes: 7 additions & 6 deletions content/workshops/esp-idf-advanced/assignment-3-1/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@ date: "2025-08-05"
series: ["WS00B"]
series_order: 10
showAuthor: false
summary: "Reduce binary size by working on configuration"
summary: "Reduce binary size by working on configuration."
---

In this assignment, you will analyze the binary image size and optimize the memory footprint of your application.

## Assignment steps

You will:
We will:

1. Build the original project to spot any oversized or suspicious sections (e.g., .text, .data, .rodata) that may hide unoptimized code.
2. Change configuration to reduce it
3. Rebuild the project to check the improvement
2. Change configuration to reduce it.
3. Rebuild the project to check the improvement.

### Build the original project

Expand Down Expand Up @@ -83,6 +84,6 @@ We gained another 6.7kb.

## Conclusion

In this assignment we saw how to check the size of our binary and how to use the menuconfig to removed unused option to improve the memory footprint of our application.
In this assignment, we saw how to check the size of our binary and how to use the menuconfig to removed unused options to improve the memory footprint of our application.

> Next step: [assignment_3_2](../assignment-3-2/)
> Next step: [assignment 3.2](../assignment-3-2/)
23 changes: 13 additions & 10 deletions content/workshops/esp-idf-advanced/assignment-3-2/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ For this assignment, you need to get the [assignment_3_2_base](https://github.co

## Assignment steps

You will
We will:

1. Enable the core dump in the menuconfig
2. Build and run the application
3. Analyze the core dump
4. Fix the bugs in the project.
4. Fix the bugs in the project
5. Build and run the application again


Expand Down Expand Up @@ -230,9 +231,10 @@ The core dump starts with:
Crashed task handle: 0x3fc9ff18, name: 'sys_evt'
Crashed task is not in the interrupt context
```
From which, we can conclude that the crash
1. Happened in the FreeRTOS task called **`sys_evt`**.
2. Did **not** happen during an interrupt, so it's a normal task context crash.
From which, we can conclude the following:

1. The crash happened in the FreeRTOS task called **`sys_evt`**.
2. The crash did **not** happen during an interrupt, so it's a normal task context crash.

#### Look at the program counter (PC) and stack trace

Expand All @@ -244,7 +246,8 @@ ra 0x4200d822 0x4200d822 <is_alarm_set+20>
sp 0x3fc9fe50
```

Which mean
It means that:

1. The program counter (PC) is at address `0x4200d840`, inside the function `is_alarm_set`, specifically at offset +50 bytes.
2. The return address (`ra`) is also inside `is_alarm_set`, which means the crash happened __inside that function__.

Expand Down Expand Up @@ -327,17 +330,17 @@ Rebuild and run the application

Another crash!

If you still have time, try to solve it by moving to [assignment 3-3](../assignment-3-2/).
If you still have time, try to solve it by moving to [assignment 3.3](../assignment-3-3/).

If you don't, don't worry: all the next assignments will be based on the [assignment 2-1](../assignment-2-1/) code.
If you don't, don't worry: all the following assignments will be based on the [assignment 2.1](../assignment-2-1/) code.


## Conclusion

In this assignment you learnt how to create a core dump and how to analyze it to understand the reason of a core crash.
In this assignment, we learnt how to create a core dump and how to analyze it to understand the reason of a core crash.
Core dump analysis is a very strong tool to debug your application.

If you still have time, try [assignment_3_3](../assignment-3-3/)
If you still have time, try [assignment 3.3](../assignment-3-3/)

Otherwise
> Next step: [Lecture 4](../lecture-4/)
4 changes: 2 additions & 2 deletions content/workshops/esp-idf-advanced/assignment-3-3/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: "ESP-IDF Adv. - Assign. 3.2"
title: "ESP-IDF Adv. - Assign. 3.3"
date: "2025-08-05"
series: ["WS00B"]
series_order: 12
Expand All @@ -19,7 +19,7 @@ Create the core dump file as you did in the previous assignment.


<details>
<summary>Expand second core dump</summary>
<summary>Expand the second core dump</summary>

```bash
Executing action: coredump-info
Expand Down
8 changes: 4 additions & 4 deletions content/workshops/esp-idf-advanced/assignment-4-1/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ To perform OTA, we need a partition table with at least two partitions.

## Assignment steps

In this first assignment, you will
In this first assignment, we will:

1. Check the current partition table loaded in your module
2. Change it to a different default partition table
Expand All @@ -22,10 +22,10 @@ In this first assignment, you will
To check the current partition table you need to

1. Read the flash and dump the partition table in a `.bin` file
2. Convert the `.bin` file to a readable format.
2. Convert the `.bin` file to a readable format

#### Read the flash
To read the flash we can use `esptool.py`
To read the flash we can use `esptool.py`:

```bash
esptool.py -p <YOUR-PORT> read_flash 0x8000 0x1000 partition_table.bin
Expand Down Expand Up @@ -98,4 +98,4 @@ Both of these partition table scheme are provided as default values from ESP-IDF
In the [next assignment](../assignment-4-2) you will create a custom partition table.


> Next step: [assignment_4_2](../assignment-4-2/)
> Next step: [assignment 4.2](../assignment-4-2/)
2 changes: 1 addition & 1 deletion content/workshops/esp-idf-advanced/assignment-4-2/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ fs,data,spiffs,0x310000,64K,
```


> Next step: [assignment_4_3](../assignment-4-3)
> Next step: [assignment 4.3](../assignment-4-3)
21 changes: 11 additions & 10 deletions content/workshops/esp-idf-advanced/assignment-4-3/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ series_order: 16
showAuthor: false
---

In this assignment we will enable the flash encryption.
In this assignment, we will enable flash encryption.

{{< alert iconColor="#df8e1d" cardColor="#edcea3">}}
Enabling flash encryption (and secure bootloader) is an irreversible operation. Double check before doing any step.
Expand All @@ -15,7 +15,7 @@ Enabling flash encryption (and secure bootloader) is an irreversible operation.

## Assignment steps

In this assignment you will
In this assignment, we will:

1. Check your device encryption status
2. Enable flash encryption (development mode)
Expand All @@ -27,7 +27,7 @@ In this assignment you will
* Open an ESP-IDF terminal : `> ESP-IDF: Open ESP-IDF Terminal`
* Inside the terminal, run `idf.py efuse-summary`

Now check the relevant EFUSES listed in the table below. They must all be at their default zero state.
Now check the relevant eFuses listed in the table below. They must all be at their default zero state.

| **eFuse** | **Description** |
|-----------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------|
Expand All @@ -38,7 +38,7 @@ Now check the relevant EFUSES listed in the table below. They must all be at the


<details>
<summary>Show the e-fuse blocks</summary>
<summary>Show the eFuse blocks</summary>

```bash
EFUSE_NAME (Block) Description = [Meaningful Value] [Readable/Writeable] (Hex Value)
Expand Down Expand Up @@ -776,7 +776,7 @@ You need to do the last two steps.


<details>
<summary>Show efuses summary</summary>
<summary>Show eFuses summary</summary>

```bash
espefuse.py v4.9.0
Expand Down Expand Up @@ -962,15 +962,16 @@ BLOCK_KEY0 (BLOCK4)
DIS_USB_JTAG (BLOCK0) Set this bit to disable function of usb switch to = True R/W (0b1)
```

We can see that
* The flash encryption is set (`SPI_BOOT_CRYPT_CNT`)
* One of the e-fuse blocks has been reserved to store the encryption key.
We can see that:

Now you're device has flash encryption. Since we selected the development, you can still reflash it using the serial port.
* The flash encryption is set (`SPI_BOOT_CRYPT_CNT`).
* One of the eFuse blocks has been reserved to store the encryption key.

Now your device has flash encryption. Since we selected the development, you can still reflash it using the serial port.

## Conclusion

In this assignment you added flash encryption to your project, by enabling the appropriate options in the menuconfig and by accomodating the partition table offset as required.
In this assignment, we added flash encryption to the project by enabling the appropriate options in the menuconfig and by accommodating the partition table offset as required.


> Next step: [Conclusion](../#conclusion)
Loading