polhenarejos / pico-fido

Transforming a Raspberry Pico into a FIDO Passkey
https://www.picokeys.com
GNU General Public License v3.0
261 stars 35 forks source link

Building image for esp32s3 target #63

Open halsbox opened 3 days ago

halsbox commented 3 days ago

Hi! What branch/tag should I use for building esp32s3 images? What's the command to build for esp32s3? What env variables should be set when building image? Where in source tree (including git submodules) should I search for and add my own board .h files (e.g. to set LED type/pins) I did a brief grep through source tree (including *-sdk) on master branch and tried running cmake with ESP_PLATFORM=1 but didn't manage to get it building. Will appreciate any help.

polhenarejos commented 2 days ago

You don't need nothing special.

If you have configured your VS Code with ESP32 plugin, the project is built smoothly.

https://github.com/espressif/vscode-esp-idf-extension/blob/master/docs/tutorial/install.md

halsbox commented 2 days ago

Thanks! Got it building with custom vid/pid. On linux I had to patch pico-keys-sdk/src/esp_compat.h:

diff --git a/src/esp_compat.h b/src/esp_compat.h
index 0379c13..6266058 100644
--- a/src/esp_compat.h
+++ b/src/esp_compat.h
@@ -20,7 +20,7 @@

 #ifdef ESP_PLATFORM

-#include "freertos/freertos.h"
+#include "freertos/FreeRTOS.h"
 #include "freertos/queue.h"
 typedef QueueHandle_t queue_t;
 #define queue_init(a,b,c) do { *(a) = xQueueCreate(c, b); } while(0)

Also found nothing VSCode specific. Any or no IDE is OK, general instructions would be:

git clone --recursive https://github.com/espressif/esp-idf.git && cd esp-idf
./install.sh esp32s3
. ./export.sh
cd /path/to/pico-fido/
idf.py -DUSB_VID=0x**** -DUSB_PID=0x**** all
idf.py flash
metabo7000 commented 1 day ago

Thanks! Got it building with custom vid/pid. On linux I had to patch pico-keys-sdk/src/esp_compat.h:

diff --git a/src/esp_compat.h b/src/esp_compat.h
index 0379c13..6266058 100644
--- a/src/esp_compat.h
+++ b/src/esp_compat.h
@@ -20,7 +20,7 @@

 #ifdef ESP_PLATFORM

-#include "freertos/freertos.h"
+#include "freertos/FreeRTOS.h"
 #include "freertos/queue.h"
 typedef QueueHandle_t queue_t;
 #define queue_init(a,b,c) do { *(a) = xQueueCreate(c, b); } while(0)

Also found nothing VSCode specific. Any or no IDE is OK, general instructions would be:

git clone --recursive https://github.com/espressif/esp-idf.git && cd esp-idf
./install.sh esp32s3
. ./export.sh
cd /path/to/pico-fido/
idf.py -DUSB_VID=0x**** -DUSB_PID=0x**** all
idf.py flash

Can you show me how you do this? I would be very grateful for a tutorial video! Developer does not help!

halsbox commented 1 day ago

Hi, @metabo7000! Please provide what OS do you use. I did build it using my Linux desktop. For linux you need git installed and do:

  1. git clone --recursive https://github.com/polhenarejos/pico-fido.git
  2. change #include "freertos/freertos.h" to #include "freertos/FreeRTOS.h" in pico-fido/pico-keys-sdk/src/esp_compat.h
  3. Follow "Step 1. Install Prerequisites" from https://docs.espressif.com/projects/esp-idf/en/stable/esp32/get-started/linux-macos-setup.html#get-started-prerequisites
  4. (replace asterisks with your desired vid and pid)
    git clone --recursive https://github.com/espressif/esp-idf.git && cd esp-idf
    ./install.sh esp32s3
    . ./export.sh
    cd ../pico-fido/
    idf.py -DUSB_VID=0x**** -DUSB_PID=0x**** all
    idf.py flash
halsbox commented 1 day ago

@metabo7000 just checked docker build is OK. If you own any OS with docker installed you can build using docker.

  1. clone https://github.com/polhenarejos/pico-fido.git including submodules using you preffered tool.
  2. patch pico-fido/pico-keys-sdk/src/esp_compat.h to include case sensitive "freertos/FreeRTOS.h" as I mentioned above
  3. go to cloned directory (e.g. cd pico-fido) and run:
    docker run --rm -v $PWD:/pico -w /pico -u $UID -e HOME=/tmp espressif/idf idf.py -DUSB_VID=0x**** -DUSB_PID=0x**** all
  4. your build firmware binaries are located in build subfolder.