From a6ae33b73f60ebf5d9d2b64f2e8a417d2d6e4f56 Mon Sep 17 00:00:00 2001 From: Amanjeev Sethi Date: Wed, 27 Jul 2022 15:51:09 -0400 Subject: [PATCH 01/20] fix(bsc): wifi connection; need to wait until the status is right --- common/lib/esp32-c3-dkc02-bsc/src/wifi.rs | 45 +++++++++++++++-------- 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/common/lib/esp32-c3-dkc02-bsc/src/wifi.rs b/common/lib/esp32-c3-dkc02-bsc/src/wifi.rs index 73d7ed14..1849f576 100644 --- a/common/lib/esp32-c3-dkc02-bsc/src/wifi.rs +++ b/common/lib/esp32-c3-dkc02-bsc/src/wifi.rs @@ -4,14 +4,15 @@ use std::sync::Arc; use anyhow::bail; use embedded_svc::wifi::{ - self, AuthMethod, ClientConfiguration, ClientConnectionStatus, ClientIpStatus, ClientStatus, - Wifi as _, + self, AuthMethod, ClientConfiguration, ClientConnectionStatus, ClientStatus, Wifi as _, }; use esp_idf_svc::{ netif::EspNetifStack, nvs::EspDefaultNvs, sysloop::EspSysLoopStack, wifi::EspWifi, }; use log::info; +const SLEEP_DURATION_BETWEEN_TRIES: std::time::Duration = std::time::Duration::from_millis(500); + #[allow(unused)] pub struct Wifi { esp_wifi: EspWifi, @@ -21,11 +22,11 @@ pub struct Wifi { } pub fn wifi(ssid: &str, psk: &str) -> anyhow::Result { - let mut auth_method = AuthMethod::WPA2Personal; - if ssid.len() == 0 { + let mut auth_method = AuthMethod::WPA2Personal; // Todo: add this setting - router dependent + if ssid.is_empty() { anyhow::bail!("missing WiFi name") } - if psk.len() == 0 { + if psk.is_empty() { auth_method = AuthMethod::None; info!("Wifi password is empty"); } @@ -63,22 +64,34 @@ pub fn wifi(ssid: &str, psk: &str) -> anyhow::Result { ssid: ssid.into(), password: psk.into(), channel, - auth_method: auth_method, + auth_method, ..Default::default() }))?; info!("getting Wifi status"); - let status = wifi.get_status(); - - if let wifi::Status( - ClientStatus::Started(ClientConnectionStatus::Connected(ClientIpStatus::Done(_))), - _, - ) = status - { - info!("Wifi connected!"); - } else { - bail!("Unexpected Wifi status: {:?}", status); + let mut status = wifi.get_status(); + // loop over the status' value until it is either connected or disconnected + // catch all is to make sure that at least if more states are added, the enum here + // remains exhaustive even though logically it might not stand up the test of time + while let wifi::Status(ClientStatus::Started(ref client_connection_status), _) = status { + match client_connection_status { + ClientConnectionStatus::Connected(_) => { + info!("Connected to Wifi"); + break; + } + ClientConnectionStatus::Disconnected => { + bail!("Disconnected from Wifi; Current status is: {:?}", status) + } + _ => { + info!( + "Retrying to connect to Wifi; Polling after sleeping {:?}; Current status is: {:?}", + SLEEP_DURATION_BETWEEN_TRIES, status + ); + std::thread::sleep(SLEEP_DURATION_BETWEEN_TRIES); + status = wifi.get_status(); + } + } } let wifi = Wifi { From 4ea371298bdae4965e2b22c6d1142b44a8cbf6fa Mon Sep 17 00:00:00 2001 From: Amanjeev Sethi Date: Fri, 29 Jul 2022 13:52:41 -0400 Subject: [PATCH 02/20] fix(wifi waiting): instead of a custom loop, use wifi waiting provided previous commit was using a custom loop but this PR comment[1] points to a better way `wait_status_with_timeout` method. this method was dependent upon using the latest versions of the dependencies, esp. esp-idf-svc. Without these updates to respective crates, Cargo was unhappy with conflicts of base crates like embeddad-hal. [1] https://github.com/ferrous-systems/espressif-trainings/pull/84#discussion_r931983892 --- common/lib/esp32-c3-dkc02-bsc/Cargo.lock | 242 +++++++++++++++++----- common/lib/esp32-c3-dkc02-bsc/Cargo.toml | 6 +- common/lib/esp32-c3-dkc02-bsc/src/wifi.rs | 48 ++--- intro/hardware-check/Cargo.toml | 1 + intro/hardware-check/src/main.rs | 3 +- 5 files changed, 219 insertions(+), 81 deletions(-) diff --git a/common/lib/esp32-c3-dkc02-bsc/Cargo.lock b/common/lib/esp32-c3-dkc02-bsc/Cargo.lock index 226588ab..4ef8c9b6 100644 --- a/common/lib/esp32-c3-dkc02-bsc/Cargo.lock +++ b/common/lib/esp32-c3-dkc02-bsc/Cargo.lock @@ -26,6 +26,15 @@ version = "1.0.53" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94a45b455c14666b85fc40a019e8ab9eb75e3a124e05494f5397122bc9eb06e0" +[[package]] +name = "atomic-polyfill" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e14bf7b4f565e5e717d7a7a65b2a05c0b8c96e4db636d6f780f03b15108cdd1b" +dependencies = [ + "critical-section", +] + [[package]] name = "atty" version = "0.2.14" @@ -45,15 +54,18 @@ checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" [[package]] name = "bare-metal" -version = "1.0.0" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8fe8f5a8a398345e52358e18ff07cc17a568fbca5c6f73873d3a62056309603" +checksum = "5deb64efa5bd81e31fcd1938615a6d98c82eafcbcd787162b6f63b91d6bac5b3" +dependencies = [ + "rustc_version 0.2.3", +] [[package]] -name = "base64" -version = "0.12.3" +name = "bare-metal" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" +checksum = "f8fe8f5a8a398345e52358e18ff07cc17a568fbca5c6f73873d3a62056309603" [[package]] name = "bindgen" @@ -84,6 +96,12 @@ version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dcb6dd1c2376d2e096796e234a70e17e94cc2d5d54ff8ce42b28cef1d0d359a4" +[[package]] +name = "bitfield" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46afbd2983a5d5a7bd740ccb198caf5b82f45c40c09c0eed36052d91cb92e719" + [[package]] name = "bitflags" version = "1.3.2" @@ -105,6 +123,12 @@ version = "1.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "439989e6b8c38d1b6570a384ef1e49c8848128f5a97f3914baef02920842712f" +[[package]] +name = "byteorder" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" + [[package]] name = "cc" version = "1.0.72" @@ -161,6 +185,30 @@ dependencies = [ "cc", ] +[[package]] +name = "cortex-m" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd20d4ac4aa86f4f75f239d59e542ef67de87cce2c282818dc6e84155d3ea126" +dependencies = [ + "bare-metal 0.2.5", + "bitfield", + "embedded-hal 0.2.7", + "volatile-register", +] + +[[package]] +name = "critical-section" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95da181745b56d4bd339530ec393508910c909c784e8962d15d722bacf0bcbcd" +dependencies = [ + "bare-metal 1.0.0", + "cfg-if", + "cortex-m", + "riscv", +] + [[package]] name = "crossbeam-channel" version = "0.5.5" @@ -208,9 +256,9 @@ dependencies = [ [[package]] name = "cstr_core" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "644828c273c063ab0d39486ba42a5d1f3a499d35529c759e763a9c6cb8a0fb08" +checksum = "dd98742e4fdca832d40cab219dc2e3048de17d873248f83f17df47c1bea70956" dependencies = [ "cty", "memchr", @@ -295,50 +343,40 @@ dependencies = [ [[package]] name = "embedded-hal" -version = "1.0.0-alpha.7" +version = "1.0.0-alpha.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93cc714edeae73aa1ff259af4498595360b2992e0e9c59801873ed198a7f2216" +checksum = "c3babfc7fd332142a0b11aebf592992f211f4e01b6222fb04b03aba1bd80018d" dependencies = [ "nb 1.0.0", ] [[package]] -name = "embedded-svc" -version = "0.19.1" +name = "embedded-io" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aeac0cf436604eced307910b6676bac59f328c07875b8f8d7c65bc5ecee9dbf4" +checksum = "36673b79844ff4ec0e3f00aeca0b2cfff564ff6739ab9801d13f45a8ec6cc1c7" dependencies = [ - "anyhow", - "enumset", "futures", - "http-auth-basic", - "log", - "no-std-net", - "num_enum", - "serde", - "serde_json", - "strum 0.23.0", - "strum_macros 0.23.1", ] [[package]] -name = "embuild" -version = "0.28.4" +name = "embedded-svc" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a76f3d7e8ed0354738a5e220441e9866cf6ce0750e446aded4c11315ae279bb8" +checksum = "b52805b9b97351bb74d61d513e226bddb81e6e5117bca61d1d4371d4c795d7cc" dependencies = [ "anyhow", - "bitflags", - "dirs", + "embedded-io", + "enumset", + "futures", + "heapless", "log", + "no-std-net", + "num_enum", "serde", "serde_json", - "shlex", "strum 0.23.0", "strum_macros 0.23.1", - "thiserror", - "toml", - "xmas-elf", ] [[package]] @@ -404,32 +442,33 @@ dependencies = [ [[package]] name = "esp-idf-hal" -version = "0.35.1" +version = "0.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c9745ec647d871638d95dd5a17e0e9cafade6b64679b3a4399d935b16887173" +checksum = "cc998eadd4eb0b3da435b72b5f4ac29b16b8937224bc08d49e5701038a1ab2d6" dependencies = [ "anyhow", "embedded-hal 0.2.7", - "embedded-hal 1.0.0-alpha.7", + "embedded-hal 1.0.0-alpha.8", "embedded-svc", - "embuild 0.28.4", + "embuild", "esp-idf-sys", "nb 0.1.3", ] [[package]] name = "esp-idf-svc" -version = "0.39.1" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "075259b99be1d75c7274399f11cbcb67415c88f7e3d822c6531fed78fcb8716d" +checksum = "98f380bf76e2fc822680a7f424051e11877e82f74fb946ed7400f9dc596bcec3" dependencies = [ "anyhow", "cstr_core", "embedded-svc", - "embuild 0.28.4", + "embuild", "enumset", "esp-idf-hal", "esp-idf-sys", + "heapless", "log", "uncased", ] @@ -442,7 +481,7 @@ checksum = "b239e46fe930f21ed36a25de1b6d29a0e22b65166f3a8e44624095a671f2f56c" dependencies = [ "anyhow", "bindgen", - "embuild 0.29.3", + "embuild", "paste", "regex", "strum 0.24.1", @@ -470,7 +509,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "382a36a399c646e7823b2fc9be785910b32c49a676c535bc63abb9acceee284c" dependencies = [ - "bare-metal", + "bare-metal 1.0.0", "riscv", "vcell", ] @@ -556,11 +595,15 @@ version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d8b7abd5d659d9b90c8cba917f6ec750a74e2dc23902ef9cd4cc8c8b22e6036a" dependencies = [ + "futures-channel", "futures-core", + "futures-io", "futures-sink", "futures-task", + "memchr", "pin-project-lite", "pin-utils", + "slab", ] [[package]] @@ -604,6 +647,29 @@ dependencies = [ "walkdir", ] +[[package]] +name = "hash32" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0c35f58762feb77d74ebe43bdbc3210f09be9fe6742234d573bacc26ed92b67" +dependencies = [ + "byteorder", +] + +[[package]] +name = "heapless" +version = "0.7.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f6733da246dc2af610133c8be0667170fd68e8ca5630936b520300eee8846f9" +dependencies = [ + "atomic-polyfill", + "hash32", + "rustc_version 0.4.0", + "serde", + "spin", + "stable_deref_trait", +] + [[package]] name = "heck" version = "0.3.3" @@ -628,15 +694,6 @@ dependencies = [ "libc", ] -[[package]] -name = "http-auth-basic" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df69b6a68474b935f436fb9c84139f32de4f7759810090d1a3a5e592553f7ee0" -dependencies = [ - "base64", -] - [[package]] name = "humantime" version = "2.1.0" @@ -710,6 +767,15 @@ dependencies = [ "winapi", ] +[[package]] +name = "lock_api" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88943dd7ef4a2e5a4bfa2753aaab3013e34ce2533d1996fb18ef591e315e2b3b" +dependencies = [ + "scopeguard", +] + [[package]] name = "log" version = "0.4.14" @@ -960,7 +1026,7 @@ name = "riscv" version = "0.7.0" source = "git+https://github.com/rust-embedded/riscv?rev=396fb9b#396fb9b8daeb11e8632e53ccc42590385a1eeb87" dependencies = [ - "bare-metal", + "bare-metal 1.0.0", "bit_field", "embedded-hal 0.2.7", "riscv-target", @@ -982,6 +1048,24 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" +[[package]] +name = "rustc_version" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +dependencies = [ + "semver 0.9.0", +] + +[[package]] +name = "rustc_version" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +dependencies = [ + "semver 1.0.12", +] + [[package]] name = "rustversion" version = "1.0.6" @@ -1009,6 +1093,27 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +[[package]] +name = "semver" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +dependencies = [ + "semver-parser", +] + +[[package]] +name = "semver" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2333e6df6d6598f2b1974829f853c2b4c5f4a6e503c10af918081aa6f8564e1" + +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" + [[package]] name = "serde" version = "1.0.136" @@ -1046,6 +1151,30 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3" +[[package]] +name = "slab" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef" +dependencies = [ + "autocfg", +] + +[[package]] +name = "spin" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f6002a767bff9e83f8eeecf883ecb8011875a21ae8da43bffb817a57e78cc09" +dependencies = [ + "lock_api", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + [[package]] name = "strsim" version = "0.8.0" @@ -1199,9 +1328,9 @@ dependencies = [ [[package]] name = "uncased" -version = "0.9.6" +version = "0.9.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5baeed7327e25054889b9bd4f975f32e5f4c5d434042d59ab6cd4142c0a76ed0" +checksum = "09b01702b0fd0b3fadcf98e098780badda8742d4f4a7676615cad90e8ac73622" dependencies = [ "version_check", ] @@ -1248,6 +1377,15 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" +[[package]] +name = "volatile-register" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ee8f19f9d74293faf70901bc20ad067dc1ad390d2cbf1e3f75f721ffee908b6" +dependencies = [ + "vcell", +] + [[package]] name = "walkdir" version = "2.3.2" diff --git a/common/lib/esp32-c3-dkc02-bsc/Cargo.toml b/common/lib/esp32-c3-dkc02-bsc/Cargo.toml index dbd01543..0cb1dc25 100644 --- a/common/lib/esp32-c3-dkc02-bsc/Cargo.toml +++ b/common/lib/esp32-c3-dkc02-bsc/Cargo.toml @@ -9,9 +9,9 @@ edition = "2021" [dependencies] esp32c3 = "=0.3.0" esp-idf-sys = { version = "=0.31.5" } -esp-idf-svc = { version="=0.39.1", features = ["experimental", "alloc"] } -esp-idf-hal = "=0.35.1" -embedded-svc = "=0.19" +esp-idf-svc = { version="=0.42.1", features = ["experimental", "alloc"] } +esp-idf-hal = "=0.38" +embedded-svc = "=0.22" rgb = "0.8" log = "0.4" anyhow = "1" diff --git a/common/lib/esp32-c3-dkc02-bsc/src/wifi.rs b/common/lib/esp32-c3-dkc02-bsc/src/wifi.rs index 1849f576..b5accc5b 100644 --- a/common/lib/esp32-c3-dkc02-bsc/src/wifi.rs +++ b/common/lib/esp32-c3-dkc02-bsc/src/wifi.rs @@ -4,14 +4,14 @@ use std::sync::Arc; use anyhow::bail; use embedded_svc::wifi::{ - self, AuthMethod, ClientConfiguration, ClientConnectionStatus, ClientStatus, Wifi as _, + self, AuthMethod, ClientConfiguration, ClientConnectionStatus, ClientIpStatus, ClientStatus, + Wifi as _, }; use esp_idf_svc::{ netif::EspNetifStack, nvs::EspDefaultNvs, sysloop::EspSysLoopStack, wifi::EspWifi, }; use log::info; - -const SLEEP_DURATION_BETWEEN_TRIES: std::time::Duration = std::time::Duration::from_millis(500); +use std::time::Duration; #[allow(unused)] pub struct Wifi { @@ -70,28 +70,26 @@ pub fn wifi(ssid: &str, psk: &str) -> anyhow::Result { info!("getting Wifi status"); - let mut status = wifi.get_status(); - // loop over the status' value until it is either connected or disconnected - // catch all is to make sure that at least if more states are added, the enum here - // remains exhaustive even though logically it might not stand up the test of time - while let wifi::Status(ClientStatus::Started(ref client_connection_status), _) = status { - match client_connection_status { - ClientConnectionStatus::Connected(_) => { - info!("Connected to Wifi"); - break; - } - ClientConnectionStatus::Disconnected => { - bail!("Disconnected from Wifi; Current status is: {:?}", status) - } - _ => { - info!( - "Retrying to connect to Wifi; Polling after sleeping {:?}; Current status is: {:?}", - SLEEP_DURATION_BETWEEN_TRIES, status - ); - std::thread::sleep(SLEEP_DURATION_BETWEEN_TRIES); - status = wifi.get_status(); - } - } + wifi.wait_status_with_timeout(Duration::from_secs(2100), |status| { + !status.is_transitional() + }) + .map_err(|err| anyhow::anyhow!("Unexpected Wifi status (Transitional state): {:?}", err))?; + + let status = wifi.get_status(); + + if let wifi::Status( + ClientStatus::Started(ClientConnectionStatus::Connected(ClientIpStatus::Done( + _ip_settings, + ))), + _, + ) = status + { + info!("Wifi connected"); + } else { + bail!( + "Could not connect to Wifi - Unexpected Wifi status: {:?}", + status + ); } let wifi = Wifi { diff --git a/intro/hardware-check/Cargo.toml b/intro/hardware-check/Cargo.toml index d5cc4087..b3813be0 100644 --- a/intro/hardware-check/Cargo.toml +++ b/intro/hardware-check/Cargo.toml @@ -18,6 +18,7 @@ native = ["esp-idf-sys/native"] [dependencies] esp-idf-sys = { version = "=0.31.5", features = ["binstart"] } +esp-idf-svc = { version="=0.42.1", features = ["experimental", "alloc"] } esp32-c3-dkc02-bsc = { path = "../../common/lib/esp32-c3-dkc02-bsc" } log = "0.4" anyhow = "1" diff --git a/intro/hardware-check/src/main.rs b/intro/hardware-check/src/main.rs index c7db94ee..3e4a177e 100644 --- a/intro/hardware-check/src/main.rs +++ b/intro/hardware-check/src/main.rs @@ -33,8 +33,9 @@ fn main() -> anyhow::Result<()> { use bsc::led::RGB8; esp_idf_sys::link_patches(); + esp_idf_svc::log::EspLogger::initialize_default(); - println!("Hello, world!"); + info!("Hello, world!"); // Start the LED off yellow let mut led = bsc::led::WS2812RMT::new()?; From 9241c7983e5e156b9ab5f5ec9adbc69f884b9b1d Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Wed, 4 May 2022 16:58:07 +0200 Subject: [PATCH 03/20] Add gitpod files --- .gitpod.Dockerfile | 43 +++++++++++++++++++++++++++++++++++++++++++ .gitpod.yml | 18 ++++++++++++++++++ README.md | 3 +++ 3 files changed, 64 insertions(+) create mode 100644 .gitpod.Dockerfile create mode 100644 .gitpod.yml diff --git a/.gitpod.Dockerfile b/.gitpod.Dockerfile new file mode 100644 index 00000000..3447455b --- /dev/null +++ b/.gitpod.Dockerfile @@ -0,0 +1,43 @@ +# Note: gitpod/workspace-base image references older version of CMake, it's necessary to install newer one +FROM gitpod/workspace-base +ENV LC_ALL=C.UTF-8 +ENV LANG=C.UTF-8 + +# Set users +ARG CONTAINER_USER=gitpod +ARG CONTAINER_GROUP=gitpod +ARG TOOLCHAIN_VERSION=1.60.0.1 + +# Install dependencies +RUN sudo install-packages git curl gcc ninja-build libudev-dev \ + python3 python3-pip libusb-1.0-0 libssl-dev pkg-config libtinfo5 clang \ + && pip3 install websockets==10.2 + +USER ${CONTAINER_USER} +WORKDIR /home/${CONTAINER_USER} + +# Install toolchain with extra crates +ARG NIGHTLY_VERSION=nightly-2022-03-10 +ENV PATH=${PATH}:/home/${CONTAINER_USER}/.cargo/bin:/home/${CONTAINER_USER}/opt/bin +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- \ + --default-toolchain ${NIGHTLY_VERSION} -y \ + && $HOME/.cargo/bin/rustup component add rust-src --toolchain ${NIGHTLY_VERSION} \ + && $HOME/.cargo/bin/rustup target add riscv32i-unknown-none-elf \ + +# Add newer version of CMake +ADD --chown=${CONTAINER_USER}:${CONTAINER_GROUP} \ + https://github.com/Kitware/CMake/releases/download/v3.23.1/cmake-3.23.1-linux-x86_64.sh \ + /home/${CONTAINER_USER}/cmake-install.sh +RUN chmod a+x /home/gitpod/cmake-install.sh \ + && mkdir -p /home/gitpod/opt \ + && ./cmake-install.sh --prefix=/home/gitpod/opt --skip-license + +ENV ESP_BOARD=esp32c3 +ENV ESP_IDF_VERSION=release/v4.4 +RUN mkdir -p /home/${CONTAINER_USER}/.espressif/frameworks/ \ + && git clone -b ${ESP_IDF_VERSION} --depth 1 --shallow-submodules \ + --recursive https://github.com/espressif/esp-idf.git \ + /home/${CONTAINER_USER}/.espressif/frameworks/esp-idf-v4.4 \ + && /home/${CONTAINER_USER}/.espressif/frameworks/esp-idf-v4.4/install.sh ${ESP_BOARD} \ + && rm -rf /home/${CONTAINER_USER}/.espressif/dist \ + && rm -rf /home/${CONTAINER_USER}/.espressif/frameworks/esp-idf-v4.4/docs \ No newline at end of file diff --git a/.gitpod.yml b/.gitpod.yml new file mode 100644 index 00000000..d495b4a8 --- /dev/null +++ b/.gitpod.yml @@ -0,0 +1,18 @@ +image: + file: .gitpod.Dockerfile +tasks: + - name: Setup environment variables for Rust and ESP-IDF + command: | + export IDF_TOOLS_PATH=/home/gitpod/.espressif + source /home/gitpod/.espressif/frameworks/esp-idf-v4.4/export.sh +vscode: + extensions: + - matklad.rust-analyzer + - tamasfe.even-better-toml + - vadimcn.vscode-lldb + - anwar.resourcemonitor + - yzhang.markdown-all-in-one + - serayuzgur.crates +ports: + - port: 9012 + visibility: public \ No newline at end of file diff --git a/README.md b/README.md index 91ef4cd4..d95e9dc4 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,9 @@ with the Espressif ESP32-C3. We suggest you start by [reading the book](https://espressif-trainings.ferrous-systems.com). + +[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://github.com/SergioGasquez/espressif-trainings/tree/feature/gitpod) + ## Contents There is: From ff74dcd0c457e9e8b91ea96fbfe2c79c608d807a Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Wed, 4 May 2022 16:59:47 +0200 Subject: [PATCH 04/20] Update gitpod button --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d95e9dc4..289cbcf4 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ with the Espressif ESP32-C3. We suggest you start by [reading the book](https://espressif-trainings.ferrous-systems.com). -[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://github.com/SergioGasquez/espressif-trainings/tree/feature/gitpod) +[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/SergioGasquez/espressif-trainings/tree/feature/gitpod) ## Contents From c7c5852d6f55ee4e0c11b6672ffebb97a13da2d2 Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Wed, 4 May 2022 17:06:02 +0200 Subject: [PATCH 05/20] Add cargo tools Remove comments --- .gitpod.Dockerfile | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/.gitpod.Dockerfile b/.gitpod.Dockerfile index 3447455b..586a89e1 100644 --- a/.gitpod.Dockerfile +++ b/.gitpod.Dockerfile @@ -2,36 +2,26 @@ FROM gitpod/workspace-base ENV LC_ALL=C.UTF-8 ENV LANG=C.UTF-8 - -# Set users ARG CONTAINER_USER=gitpod ARG CONTAINER_GROUP=gitpod -ARG TOOLCHAIN_VERSION=1.60.0.1 - -# Install dependencies RUN sudo install-packages git curl gcc ninja-build libudev-dev \ python3 python3-pip libusb-1.0-0 libssl-dev pkg-config libtinfo5 clang \ - && pip3 install websockets==10.2 - + && pip3 install websockets==10.2 USER ${CONTAINER_USER} WORKDIR /home/${CONTAINER_USER} - -# Install toolchain with extra crates ARG NIGHTLY_VERSION=nightly-2022-03-10 ENV PATH=${PATH}:/home/${CONTAINER_USER}/.cargo/bin:/home/${CONTAINER_USER}/opt/bin RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- \ --default-toolchain ${NIGHTLY_VERSION} -y \ && $HOME/.cargo/bin/rustup component add rust-src --toolchain ${NIGHTLY_VERSION} \ && $HOME/.cargo/bin/rustup target add riscv32i-unknown-none-elf \ - -# Add newer version of CMake + && $HOME/.cargo/bin/cargo install cargo-generate cargo-espflash espmonitor bindgen ldproxy ADD --chown=${CONTAINER_USER}:${CONTAINER_GROUP} \ https://github.com/Kitware/CMake/releases/download/v3.23.1/cmake-3.23.1-linux-x86_64.sh \ /home/${CONTAINER_USER}/cmake-install.sh RUN chmod a+x /home/gitpod/cmake-install.sh \ && mkdir -p /home/gitpod/opt \ - && ./cmake-install.sh --prefix=/home/gitpod/opt --skip-license - + && ./cmake-install.sh --prefix=/home/gitpod/opt --skip-license ENV ESP_BOARD=esp32c3 ENV ESP_IDF_VERSION=release/v4.4 RUN mkdir -p /home/${CONTAINER_USER}/.espressif/frameworks/ \ From fd240639ab4e82c2935e40c8fa086fecf3977499 Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Wed, 4 May 2022 21:05:08 +0200 Subject: [PATCH 06/20] Dont install CMake Add ESP_IDF_TOOLS_INSTALL_DIR --- .gitpod.Dockerfile | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.gitpod.Dockerfile b/.gitpod.Dockerfile index 586a89e1..b3c2cb67 100644 --- a/.gitpod.Dockerfile +++ b/.gitpod.Dockerfile @@ -5,7 +5,7 @@ ENV LANG=C.UTF-8 ARG CONTAINER_USER=gitpod ARG CONTAINER_GROUP=gitpod RUN sudo install-packages git curl gcc ninja-build libudev-dev \ - python3 python3-pip libusb-1.0-0 libssl-dev pkg-config libtinfo5 clang \ + python3 python3-pip libusb-1.0-0 libssl-dev pkg-config libtinfo5 clang \ && pip3 install websockets==10.2 USER ${CONTAINER_USER} WORKDIR /home/${CONTAINER_USER} @@ -16,12 +16,13 @@ RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- \ && $HOME/.cargo/bin/rustup component add rust-src --toolchain ${NIGHTLY_VERSION} \ && $HOME/.cargo/bin/rustup target add riscv32i-unknown-none-elf \ && $HOME/.cargo/bin/cargo install cargo-generate cargo-espflash espmonitor bindgen ldproxy -ADD --chown=${CONTAINER_USER}:${CONTAINER_GROUP} \ - https://github.com/Kitware/CMake/releases/download/v3.23.1/cmake-3.23.1-linux-x86_64.sh \ - /home/${CONTAINER_USER}/cmake-install.sh -RUN chmod a+x /home/gitpod/cmake-install.sh \ - && mkdir -p /home/gitpod/opt \ - && ./cmake-install.sh --prefix=/home/gitpod/opt --skip-license +# ADD --chown=${CONTAINER_USER}:${CONTAINER_GROUP} \ +# https://github.com/Kitware/CMake/releases/download/v3.23.1/cmake-3.23.1-linux-x86_64.sh \ +# /home/${CONTAINER_USER}/cmake-install.sh +# RUN chmod a+x /home/gitpod/cmake-install.sh \ +# && mkdir -p /home/gitpod/opt \ +# && ./cmake-install.sh --prefix=/home/gitpod/opt --skip-license +ENV ESP_IDF_TOOLS_INSTALL_DIR=global ENV ESP_BOARD=esp32c3 ENV ESP_IDF_VERSION=release/v4.4 RUN mkdir -p /home/${CONTAINER_USER}/.espressif/frameworks/ \ From c0b176553ac9b6efbc971b31c177dc7529c2632d Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Thu, 5 May 2022 08:17:25 +0000 Subject: [PATCH 07/20] Installl ninja and cmake with idf_tools --- .gitpod.Dockerfile | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/.gitpod.Dockerfile b/.gitpod.Dockerfile index b3c2cb67..f84c5e7b 100644 --- a/.gitpod.Dockerfile +++ b/.gitpod.Dockerfile @@ -16,19 +16,14 @@ RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- \ && $HOME/.cargo/bin/rustup component add rust-src --toolchain ${NIGHTLY_VERSION} \ && $HOME/.cargo/bin/rustup target add riscv32i-unknown-none-elf \ && $HOME/.cargo/bin/cargo install cargo-generate cargo-espflash espmonitor bindgen ldproxy -# ADD --chown=${CONTAINER_USER}:${CONTAINER_GROUP} \ -# https://github.com/Kitware/CMake/releases/download/v3.23.1/cmake-3.23.1-linux-x86_64.sh \ -# /home/${CONTAINER_USER}/cmake-install.sh -# RUN chmod a+x /home/gitpod/cmake-install.sh \ -# && mkdir -p /home/gitpod/opt \ -# && ./cmake-install.sh --prefix=/home/gitpod/opt --skip-license -ENV ESP_IDF_TOOLS_INSTALL_DIR=global +# ENV ESP_IDF_TOOLS_INSTALL_DIR=global ENV ESP_BOARD=esp32c3 ENV ESP_IDF_VERSION=release/v4.4 RUN mkdir -p /home/${CONTAINER_USER}/.espressif/frameworks/ \ && git clone -b ${ESP_IDF_VERSION} --depth 1 --shallow-submodules \ --recursive https://github.com/espressif/esp-idf.git \ /home/${CONTAINER_USER}/.espressif/frameworks/esp-idf-v4.4 \ + && python3 .espressif/frameworks/esp-idf-v4.4/tools/idf_tools.py install cmake ninja \ && /home/${CONTAINER_USER}/.espressif/frameworks/esp-idf-v4.4/install.sh ${ESP_BOARD} \ && rm -rf /home/${CONTAINER_USER}/.espressif/dist \ && rm -rf /home/${CONTAINER_USER}/.espressif/frameworks/esp-idf-v4.4/docs \ No newline at end of file From 3259f665b7f461235b58024514ca8c44fa411d74 Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Thu, 5 May 2022 12:00:52 +0000 Subject: [PATCH 08/20] Format gitpod.Dockerfile --- .gitpod.Dockerfile | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.gitpod.Dockerfile b/.gitpod.Dockerfile index f84c5e7b..69072f68 100644 --- a/.gitpod.Dockerfile +++ b/.gitpod.Dockerfile @@ -4,26 +4,25 @@ ENV LC_ALL=C.UTF-8 ENV LANG=C.UTF-8 ARG CONTAINER_USER=gitpod ARG CONTAINER_GROUP=gitpod +ARG NIGHTLY_VERSION=nightly-2022-03-10 RUN sudo install-packages git curl gcc ninja-build libudev-dev \ python3 python3-pip libusb-1.0-0 libssl-dev pkg-config libtinfo5 clang \ && pip3 install websockets==10.2 USER ${CONTAINER_USER} WORKDIR /home/${CONTAINER_USER} -ARG NIGHTLY_VERSION=nightly-2022-03-10 ENV PATH=${PATH}:/home/${CONTAINER_USER}/.cargo/bin:/home/${CONTAINER_USER}/opt/bin RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- \ --default-toolchain ${NIGHTLY_VERSION} -y \ && $HOME/.cargo/bin/rustup component add rust-src --toolchain ${NIGHTLY_VERSION} \ && $HOME/.cargo/bin/rustup target add riscv32i-unknown-none-elf \ && $HOME/.cargo/bin/cargo install cargo-generate cargo-espflash espmonitor bindgen ldproxy -# ENV ESP_IDF_TOOLS_INSTALL_DIR=global ENV ESP_BOARD=esp32c3 ENV ESP_IDF_VERSION=release/v4.4 -RUN mkdir -p /home/${CONTAINER_USER}/.espressif/frameworks/ \ +RUN mkdir -p .espressif/frameworks/ \ && git clone -b ${ESP_IDF_VERSION} --depth 1 --shallow-submodules \ --recursive https://github.com/espressif/esp-idf.git \ - /home/${CONTAINER_USER}/.espressif/frameworks/esp-idf-v4.4 \ + .espressif/frameworks/esp-idf-v4.4 \ && python3 .espressif/frameworks/esp-idf-v4.4/tools/idf_tools.py install cmake ninja \ - && /home/${CONTAINER_USER}/.espressif/frameworks/esp-idf-v4.4/install.sh ${ESP_BOARD} \ - && rm -rf /home/${CONTAINER_USER}/.espressif/dist \ - && rm -rf /home/${CONTAINER_USER}/.espressif/frameworks/esp-idf-v4.4/docs \ No newline at end of file + && .espressif/frameworks/esp-idf-v4.4/install.sh ${ESP_BOARD} \ + && rm -rf .espressif/dist \ + && rm -rf .espressif/frameworks/esp-idf-v4.4/docs \ No newline at end of file From bde26d861e9b8ba8a49bff945980139f837a1da0 Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Thu, 5 May 2022 12:35:21 +0000 Subject: [PATCH 09/20] Remove task --- .gitpod.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.gitpod.yml b/.gitpod.yml index d495b4a8..7d74c719 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -1,10 +1,5 @@ image: file: .gitpod.Dockerfile -tasks: - - name: Setup environment variables for Rust and ESP-IDF - command: | - export IDF_TOOLS_PATH=/home/gitpod/.espressif - source /home/gitpod/.espressif/frameworks/esp-idf-v4.4/export.sh vscode: extensions: - matklad.rust-analyzer From f93271ef1ab851d729e67bf957a076e04ca61068 Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Thu, 5 May 2022 12:50:42 +0000 Subject: [PATCH 10/20] Add wokwi alias --- .gitpod.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitpod.yml b/.gitpod.yml index 7d74c719..cce62fc2 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -1,5 +1,9 @@ image: file: .gitpod.Dockerfile +tasks: + - name: Setup wokwi alias + command: | + alias wokwi='bash /workspace/ferrous-training/wokwi/run.sh' vscode: extensions: - matklad.rust-analyzer From 83ef26509f03236eccfd7a1e36ebf3d4550185ef Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Thu, 5 May 2022 12:53:40 +0000 Subject: [PATCH 11/20] Remove wokwi alias --- .gitpod.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.gitpod.yml b/.gitpod.yml index cce62fc2..7d74c719 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -1,9 +1,5 @@ image: file: .gitpod.Dockerfile -tasks: - - name: Setup wokwi alias - command: | - alias wokwi='bash /workspace/ferrous-training/wokwi/run.sh' vscode: extensions: - matklad.rust-analyzer From bb8b470f387982ada057a7a8bffbc6b9c9b5b2eb Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Thu, 5 May 2022 22:14:56 +0200 Subject: [PATCH 12/20] Update gitpod button --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 289cbcf4..1e49e9f3 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ with the Espressif ESP32-C3. We suggest you start by [reading the book](https://espressif-trainings.ferrous-systems.com). -[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/SergioGasquez/espressif-trainings/tree/feature/gitpod) +[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/ferrous-systems/espressif-trainings) ## Contents From 5a4d826bff0b5015271c13312314f3e6a74a0e2f Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Sun, 8 May 2022 00:37:14 +0200 Subject: [PATCH 13/20] Fix ESP-IDF environment --- .gitpod.Dockerfile | 10 ++++++---- .gitpod.yml | 4 ++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.gitpod.Dockerfile b/.gitpod.Dockerfile index 69072f68..bfc704f4 100644 --- a/.gitpod.Dockerfile +++ b/.gitpod.Dockerfile @@ -5,12 +5,12 @@ ENV LANG=C.UTF-8 ARG CONTAINER_USER=gitpod ARG CONTAINER_GROUP=gitpod ARG NIGHTLY_VERSION=nightly-2022-03-10 -RUN sudo install-packages git curl gcc ninja-build libudev-dev \ +RUN sudo install-packages git curl gcc libudev-dev \ python3 python3-pip libusb-1.0-0 libssl-dev pkg-config libtinfo5 clang \ && pip3 install websockets==10.2 USER ${CONTAINER_USER} WORKDIR /home/${CONTAINER_USER} -ENV PATH=${PATH}:/home/${CONTAINER_USER}/.cargo/bin:/home/${CONTAINER_USER}/opt/bin +ENV PATH=${PATH}:/home/${CONTAINER_USER}/.cargo/bin RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- \ --default-toolchain ${NIGHTLY_VERSION} -y \ && $HOME/.cargo/bin/rustup component add rust-src --toolchain ${NIGHTLY_VERSION} \ @@ -18,11 +18,13 @@ RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- \ && $HOME/.cargo/bin/cargo install cargo-generate cargo-espflash espmonitor bindgen ldproxy ENV ESP_BOARD=esp32c3 ENV ESP_IDF_VERSION=release/v4.4 +ENV ESP_IDF_TOOLS_INSTALL_DIR=global RUN mkdir -p .espressif/frameworks/ \ - && git clone -b ${ESP_IDF_VERSION} --depth 1 --shallow-submodules \ + && git clone --branch ${ESP_IDF_VERSION} -q --depth 1 --shallow-submodules \ --recursive https://github.com/espressif/esp-idf.git \ .espressif/frameworks/esp-idf-v4.4 \ && python3 .espressif/frameworks/esp-idf-v4.4/tools/idf_tools.py install cmake ninja \ && .espressif/frameworks/esp-idf-v4.4/install.sh ${ESP_BOARD} \ && rm -rf .espressif/dist \ - && rm -rf .espressif/frameworks/esp-idf-v4.4/docs \ No newline at end of file + && rm -rf .espressif/frameworks/esp-idf-v4.4/docs +ENV IDF_TOOLS_PATH=/home/${CONTAINER_USER}/.espressif \ No newline at end of file diff --git a/.gitpod.yml b/.gitpod.yml index 7d74c719..1a42e3dc 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -1,5 +1,9 @@ image: file: .gitpod.Dockerfile +tasks: + - name: Setup environment variables for ESP-IDF + command: | + source /home/gitpod/.espressif/frameworks/esp-idf-v4.4/export.sh vscode: extensions: - matklad.rust-analyzer From 9425491746324b6990a0a85cac5c31c8acb68820 Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Sun, 8 May 2022 10:48:09 +0200 Subject: [PATCH 14/20] Intaslla ninja with install-packages Cleanup of environment variables --- .gitpod.Dockerfile | 7 +++---- .gitpod.yml | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.gitpod.Dockerfile b/.gitpod.Dockerfile index bfc704f4..c037f063 100644 --- a/.gitpod.Dockerfile +++ b/.gitpod.Dockerfile @@ -5,7 +5,8 @@ ENV LANG=C.UTF-8 ARG CONTAINER_USER=gitpod ARG CONTAINER_GROUP=gitpod ARG NIGHTLY_VERSION=nightly-2022-03-10 -RUN sudo install-packages git curl gcc libudev-dev \ +ARG ESP_IDF_VERSION=release/v4.4 +RUN sudo install-packages git curl gcc ninja-build libudev-dev \ python3 python3-pip libusb-1.0-0 libssl-dev pkg-config libtinfo5 clang \ && pip3 install websockets==10.2 USER ${CONTAINER_USER} @@ -17,13 +18,11 @@ RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- \ && $HOME/.cargo/bin/rustup target add riscv32i-unknown-none-elf \ && $HOME/.cargo/bin/cargo install cargo-generate cargo-espflash espmonitor bindgen ldproxy ENV ESP_BOARD=esp32c3 -ENV ESP_IDF_VERSION=release/v4.4 -ENV ESP_IDF_TOOLS_INSTALL_DIR=global RUN mkdir -p .espressif/frameworks/ \ && git clone --branch ${ESP_IDF_VERSION} -q --depth 1 --shallow-submodules \ --recursive https://github.com/espressif/esp-idf.git \ .espressif/frameworks/esp-idf-v4.4 \ - && python3 .espressif/frameworks/esp-idf-v4.4/tools/idf_tools.py install cmake ninja \ + && python3 .espressif/frameworks/esp-idf-v4.4/tools/idf_tools.py install cmake \ && .espressif/frameworks/esp-idf-v4.4/install.sh ${ESP_BOARD} \ && rm -rf .espressif/dist \ && rm -rf .espressif/frameworks/esp-idf-v4.4/docs diff --git a/.gitpod.yml b/.gitpod.yml index 1a42e3dc..a0cb8ee5 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -3,7 +3,7 @@ image: tasks: - name: Setup environment variables for ESP-IDF command: | - source /home/gitpod/.espressif/frameworks/esp-idf-v4.4/export.sh + source /home/gitpod/.espressif/frameworks/esp-idf-v4.4/export.sh > /dev/null 2>&1 vscode: extensions: - matklad.rust-analyzer From 11f0c442ab91680a17f4e81455d6f68c6d065a55 Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Mon, 9 May 2022 12:50:08 +0200 Subject: [PATCH 15/20] Delete unecesary esp-idf folders Use ESP_BOARD as ARG --- .gitpod.Dockerfile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.gitpod.Dockerfile b/.gitpod.Dockerfile index c037f063..b233ed09 100644 --- a/.gitpod.Dockerfile +++ b/.gitpod.Dockerfile @@ -6,6 +6,7 @@ ARG CONTAINER_USER=gitpod ARG CONTAINER_GROUP=gitpod ARG NIGHTLY_VERSION=nightly-2022-03-10 ARG ESP_IDF_VERSION=release/v4.4 +ARG ESP_BOARD=esp32c3 RUN sudo install-packages git curl gcc ninja-build libudev-dev \ python3 python3-pip libusb-1.0-0 libssl-dev pkg-config libtinfo5 clang \ && pip3 install websockets==10.2 @@ -17,7 +18,6 @@ RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- \ && $HOME/.cargo/bin/rustup component add rust-src --toolchain ${NIGHTLY_VERSION} \ && $HOME/.cargo/bin/rustup target add riscv32i-unknown-none-elf \ && $HOME/.cargo/bin/cargo install cargo-generate cargo-espflash espmonitor bindgen ldproxy -ENV ESP_BOARD=esp32c3 RUN mkdir -p .espressif/frameworks/ \ && git clone --branch ${ESP_IDF_VERSION} -q --depth 1 --shallow-submodules \ --recursive https://github.com/espressif/esp-idf.git \ @@ -25,5 +25,8 @@ RUN mkdir -p .espressif/frameworks/ \ && python3 .espressif/frameworks/esp-idf-v4.4/tools/idf_tools.py install cmake \ && .espressif/frameworks/esp-idf-v4.4/install.sh ${ESP_BOARD} \ && rm -rf .espressif/dist \ - && rm -rf .espressif/frameworks/esp-idf-v4.4/docs + && rm -rf .espressif/frameworks/esp-idf-v4.4/docs \ + && rm -rf .espressif/frameworks/esp-idf-v4.4/examples \ + && rm -rf .espressif/frameworks/esp-idf-v4.4/tools/esp_app_trace \ + && rm -rf .espressif/frameworks/esp-idf-v4.4/tools/test_idf_size ENV IDF_TOOLS_PATH=/home/${CONTAINER_USER}/.espressif \ No newline at end of file From 0ed718a36faab972e8e65cc1c1a58685c22c4e79 Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Wed, 11 May 2022 16:07:13 +0200 Subject: [PATCH 16/20] Remove installing python dependencies --- .gitpod.Dockerfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.gitpod.Dockerfile b/.gitpod.Dockerfile index b233ed09..1fd75eb0 100644 --- a/.gitpod.Dockerfile +++ b/.gitpod.Dockerfile @@ -7,9 +7,8 @@ ARG CONTAINER_GROUP=gitpod ARG NIGHTLY_VERSION=nightly-2022-03-10 ARG ESP_IDF_VERSION=release/v4.4 ARG ESP_BOARD=esp32c3 -RUN sudo install-packages git curl gcc ninja-build libudev-dev \ - python3 python3-pip libusb-1.0-0 libssl-dev pkg-config libtinfo5 clang \ - && pip3 install websockets==10.2 +RUN sudo install-packages git curl gcc clang ninja-build libudev-dev \ + python3 python3-pip libusb-1.0-0 libssl-dev pkg-config libtinfo5 libpython2.7 USER ${CONTAINER_USER} WORKDIR /home/${CONTAINER_USER} ENV PATH=${PATH}:/home/${CONTAINER_USER}/.cargo/bin From 280533835e1c722581463ef8e0619d36c49efa4f Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Fri, 13 May 2022 15:23:37 +0200 Subject: [PATCH 17/20] Remove bindgen --- .gitpod.Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitpod.Dockerfile b/.gitpod.Dockerfile index 1fd75eb0..8bfa0cc8 100644 --- a/.gitpod.Dockerfile +++ b/.gitpod.Dockerfile @@ -16,7 +16,7 @@ RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- \ --default-toolchain ${NIGHTLY_VERSION} -y \ && $HOME/.cargo/bin/rustup component add rust-src --toolchain ${NIGHTLY_VERSION} \ && $HOME/.cargo/bin/rustup target add riscv32i-unknown-none-elf \ - && $HOME/.cargo/bin/cargo install cargo-generate cargo-espflash espmonitor bindgen ldproxy + && $HOME/.cargo/bin/cargo install cargo-generate cargo-espflash espmonitor ldproxy RUN mkdir -p .espressif/frameworks/ \ && git clone --branch ${ESP_IDF_VERSION} -q --depth 1 --shallow-submodules \ --recursive https://github.com/espressif/esp-idf.git \ From 28be80e56e85e740b7809b417de8ef5aa12db486 Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Arcos Date: Tue, 19 Jul 2022 16:34:11 +0200 Subject: [PATCH 18/20] Remove espmonitor and cargo-generate --- .gitpod.Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitpod.Dockerfile b/.gitpod.Dockerfile index 8bfa0cc8..8ae56e39 100644 --- a/.gitpod.Dockerfile +++ b/.gitpod.Dockerfile @@ -16,7 +16,7 @@ RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- \ --default-toolchain ${NIGHTLY_VERSION} -y \ && $HOME/.cargo/bin/rustup component add rust-src --toolchain ${NIGHTLY_VERSION} \ && $HOME/.cargo/bin/rustup target add riscv32i-unknown-none-elf \ - && $HOME/.cargo/bin/cargo install cargo-generate cargo-espflash espmonitor ldproxy + && $HOME/.cargo/bin/cargo install cargo-espflash ldproxy RUN mkdir -p .espressif/frameworks/ \ && git clone --branch ${ESP_IDF_VERSION} -q --depth 1 --shallow-submodules \ --recursive https://github.com/espressif/esp-idf.git \ @@ -28,4 +28,4 @@ RUN mkdir -p .espressif/frameworks/ \ && rm -rf .espressif/frameworks/esp-idf-v4.4/examples \ && rm -rf .espressif/frameworks/esp-idf-v4.4/tools/esp_app_trace \ && rm -rf .espressif/frameworks/esp-idf-v4.4/tools/test_idf_size -ENV IDF_TOOLS_PATH=/home/${CONTAINER_USER}/.espressif \ No newline at end of file +ENV IDF_TOOLS_PATH=/home/${CONTAINER_USER}/.espressif From bc74647865c366b97b95764d2f03644d52c458cb Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Wed, 20 Jul 2022 11:31:08 +0200 Subject: [PATCH 19/20] Update target --- .gitpod.Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitpod.Dockerfile b/.gitpod.Dockerfile index 8ae56e39..3edb4e61 100644 --- a/.gitpod.Dockerfile +++ b/.gitpod.Dockerfile @@ -15,7 +15,7 @@ ENV PATH=${PATH}:/home/${CONTAINER_USER}/.cargo/bin RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- \ --default-toolchain ${NIGHTLY_VERSION} -y \ && $HOME/.cargo/bin/rustup component add rust-src --toolchain ${NIGHTLY_VERSION} \ - && $HOME/.cargo/bin/rustup target add riscv32i-unknown-none-elf \ + && $HOME/.cargo/bin/rustup target add riscv32imc-unknown-none-elf \ && $HOME/.cargo/bin/cargo install cargo-espflash ldproxy RUN mkdir -p .espressif/frameworks/ \ && git clone --branch ${ESP_IDF_VERSION} -q --depth 1 --shallow-submodules \ From 791d457ab5c85fb38fa2857d93707faca6bfff62 Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Mon, 25 Jul 2022 11:50:20 +0200 Subject: [PATCH 20/20] Update esp-idf version and installation paths --- .gitpod.Dockerfile | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.gitpod.Dockerfile b/.gitpod.Dockerfile index 3edb4e61..c7fdf763 100644 --- a/.gitpod.Dockerfile +++ b/.gitpod.Dockerfile @@ -5,7 +5,7 @@ ENV LANG=C.UTF-8 ARG CONTAINER_USER=gitpod ARG CONTAINER_GROUP=gitpod ARG NIGHTLY_VERSION=nightly-2022-03-10 -ARG ESP_IDF_VERSION=release/v4.4 +ARG ESP_IDF_VERSION=v4.4.1 ARG ESP_BOARD=esp32c3 RUN sudo install-packages git curl gcc clang ninja-build libudev-dev \ python3 python3-pip libusb-1.0-0 libssl-dev pkg-config libtinfo5 libpython2.7 @@ -17,15 +17,15 @@ RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- \ && $HOME/.cargo/bin/rustup component add rust-src --toolchain ${NIGHTLY_VERSION} \ && $HOME/.cargo/bin/rustup target add riscv32imc-unknown-none-elf \ && $HOME/.cargo/bin/cargo install cargo-espflash ldproxy -RUN mkdir -p .espressif/frameworks/ \ +RUN mkdir -p ${HOME}/.espressif/frameworks/ \ && git clone --branch ${ESP_IDF_VERSION} -q --depth 1 --shallow-submodules \ --recursive https://github.com/espressif/esp-idf.git \ - .espressif/frameworks/esp-idf-v4.4 \ - && python3 .espressif/frameworks/esp-idf-v4.4/tools/idf_tools.py install cmake \ - && .espressif/frameworks/esp-idf-v4.4/install.sh ${ESP_BOARD} \ + ${HOME}/.espressif/frameworks/esp-idf \ + && python3 ${HOME}/.espressif/frameworks/esp-idf/tools/idf_tools.py install cmake \ + && ${HOME}/.espressif/frameworks/esp-idf/install.sh ${ESP_BOARD} \ && rm -rf .espressif/dist \ - && rm -rf .espressif/frameworks/esp-idf-v4.4/docs \ - && rm -rf .espressif/frameworks/esp-idf-v4.4/examples \ - && rm -rf .espressif/frameworks/esp-idf-v4.4/tools/esp_app_trace \ - && rm -rf .espressif/frameworks/esp-idf-v4.4/tools/test_idf_size + && rm -rf .espressif/frameworks/esp-idf/docs \ + && rm -rf .espressif/frameworks/esp-idf/examples \ + && rm -rf .espressif/frameworks/esp-idf/tools/esp_app_trace \ + && rm -rf .espressif/frameworks/esp-idf/tools/test_idf_size ENV IDF_TOOLS_PATH=/home/${CONTAINER_USER}/.espressif