Day1:-ESP-IDF set up for a project

My Setup

I’ve chosen CLion as my weapon of choice for this project, thanks to its slick built-in MISRA C support (we’ll dig into that later). Currently, I’m cruising on my Dell G15 5515 Ryzen edition, running a dual-boot setup with Windows 11 and Ubuntu 22.04 LTS. (Yep, I’ve played with Arch, but no way am I sacrificing ROS for it!)

Starting Fresh with ESP-IDF

I began by installing ESP-IDF from scratch. Everything seemed fine until I tried to install the specific esp32-c6 version. The compiler didn’t find ‘xtensa-esp32-elf-gcc’, which was weird for a fresh install.

1
2
CMake Error at /home/thedevmanek/esp/esp-idf/tools/cmake/project.cmake:448 
(__project):The CMAKE_C_COMPILER:xtensa-esp32-elf-gcc

To fix this, I reinstalled ESP-IDF without specifying the chip version, and that worked like a charm. I ran the “hello-world” example, and yay, it worked!

Getting the Project on Track

I believe in starting a project right, and that means having a solid README.md. I goofed a bit during a pull request (PR) – didn’t do the squash and merge thing 😭. No worries, though. I fixed it by reverting, adding a note about squash and merge in the README, and finally merging the PR.

Now, let’s talk security for PRs. I added some important stuff:

  • Only Verified Commits Allowed: Making sure each commit is legit.
  • Need at Least 1 Review to Merge: Double-checking things with another set of eyes.
  • Sort Out Comments Before Merging: Making sure all comments are resolved before the merge happens.

These steps might sound like a lot, but they’re just my way of making sure our project stays strong and secure.

Whenever I start a new project on GitHub, I make it a point to create a fresh file in the Projects folder. This little step goes a long way in keeping things organized. It’s like having a virtual whiteboard where I jot down features and track progress. Plus, it acts as a public commitment, showing that I’m all in for the success of the project. It’s my way of saying, “Hey world, here’s what we’re working on, and we’re committed to making it awesome!” 🚀

Some Test with Bluetooth

Bluetooth Testing and ESP32-C6 Quirk

Pro tip: Stick to examples from the esp-idf installation folder. It’s a good shield against the notorious big breaking changes. And hey, consider using the LTS version for a smoother ride – fewer surprises, fewer changes to handle.

I ran some Bluetooth tests to ensure everything was smooth, but here’s the catch: ESP32-C6 doesn’t work with Bluetooth classic; it only supports BLE. Save yourself from potential debugging headaches like this.

1
2
undefined reference to `esp_ble_gap_start_advertising'
collect2: error: ld returned 1 exit status

Quick tip: Always check the board compatibility info in the examples. The Espressif folks graciously provide this. Don’t end up being a 🤡 like me!

More dumb dev moments

So, after ghosting ESP-IDF for a good two months, my lack of practice really hit me hard! Tried compiling my project and bam, two things I totally spaced on.

First off, this line will make your life hell if you ignore it!Newer ESP-IDF versions politely nudge you about it but try to be a good human.

1
REQUIRES esp_wifi bt esp_hid driver

Don’t forget to throw in all your source files. I didn’t, and let me tell you, it led to some serious pondering about life choices. Just trust me on this one:

1
SRCS "bluetooth-controller.c"

Oh, and one more thing – check that your #include game is strong, and in your main folder’s CMakeLists, shout out the name of your component like:

1
REQUIRES bluetooth-controller

What’s a component, you ask? I’ll spill the beans in the next blog post. But first, coffee ☕️ and then time to get back to the grind!
PS:-I just got a new domain from porkbun for just £7.6 a year so check them out ig?