Skip to content

Commit 1588db5

Browse files
committed
add rusty_hangulclock
1 parent c4795da commit 1588db5

File tree

21 files changed

+498
-1
lines changed

21 files changed

+498
-1
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module github.com/suapapa/HangulClock/sbc_hangulclock
1+
module github.com/suapapa/HangulClock/go_hangulclock
22

33
go 1.19
44

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[build]
2+
target = "xtensa-esp32s2-espidf"
3+
4+
[target.xtensa-esp32s2-espidf]
5+
linker = "ldproxy"
6+
runner = "espflash flash --monitor" # Select this runner for espflash v3.x.x
7+
rustflags = [ "--cfg", "espidf_time64"] # Extending time_t for ESP IDF 5: https://github.com/esp-rs/rust/issues/110
8+
9+
[unstable]
10+
build-std = ["std", "panic_abort"]
11+
12+
[env]
13+
MCU="esp32s2"
14+
# Note: this variable is not used by the pio builder (`cargo build --features pio`)
15+
ESP_IDF_VERSION = "v5.2.2"
16+
17+
# Workaround for https://github.com/esp-rs/esp-idf-template/issues/174
18+
CRATE_CC_NO_DEFAULTS = "1"
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
ARG VARIANT=bookworm-slim
2+
FROM debian:${VARIANT}
3+
ENV DEBIAN_FRONTEND=noninteractive
4+
ENV LC_ALL=C.UTF-8
5+
ENV LANG=C.UTF-8
6+
7+
# Arguments
8+
ARG CONTAINER_USER=esp
9+
ARG CONTAINER_GROUP=esp
10+
ARG ESP_BOARD=all
11+
ARG GITHUB_TOKEN
12+
13+
# Install dependencies
14+
RUN apt-get update \
15+
&& apt-get install -y pkg-config curl gcc clang libudev-dev unzip xz-utils \
16+
git wget flex bison gperf python3 python3-pip python3-venv cmake ninja-build ccache libffi-dev libssl-dev dfu-util libusb-1.0-0 \
17+
&& apt-get clean -y && rm -rf /var/lib/apt/lists/* /tmp/library-scripts
18+
19+
# Set users
20+
RUN adduser --disabled-password --gecos "" ${CONTAINER_USER}
21+
USER ${CONTAINER_USER}
22+
WORKDIR /home/${CONTAINER_USER}
23+
24+
# Install rustup
25+
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- \
26+
--default-toolchain none -y --profile minimal
27+
28+
# Update envs
29+
ENV PATH=${PATH}:/home/${CONTAINER_USER}/.cargo/bin
30+
31+
# Install extra crates
32+
RUN ARCH=$($HOME/.cargo/bin/rustup show | grep "Default host" | sed -e 's/.* //') && \
33+
curl -L "https://github.com/esp-rs/espup/releases/latest/download/espup-${ARCH}" -o "${HOME}/.cargo/bin/espup" && \
34+
chmod u+x "${HOME}/.cargo/bin/espup" && \
35+
curl -L "https://github.com/esp-rs/espflash/releases/latest/download/cargo-espflash-${ARCH}.zip" -o "${HOME}/.cargo/bin/cargo-espflash.zip" && \
36+
unzip "${HOME}/.cargo/bin/cargo-espflash.zip" -d "${HOME}/.cargo/bin/" && \
37+
rm "${HOME}/.cargo/bin/cargo-espflash.zip" && \
38+
chmod u+x "${HOME}/.cargo/bin/cargo-espflash" && \
39+
curl -L "https://github.com/esp-rs/espflash/releases/latest/download/espflash-${ARCH}.zip" -o "${HOME}/.cargo/bin/espflash.zip" && \
40+
unzip "${HOME}/.cargo/bin/espflash.zip" -d "${HOME}/.cargo/bin/" && \
41+
rm "${HOME}/.cargo/bin/espflash.zip" && \
42+
chmod u+x "${HOME}/.cargo/bin/espflash" && \
43+
curl -L "https://github.com/esp-rs/embuild/releases/latest/download/ldproxy-${ARCH}.zip" -o "${HOME}/.cargo/bin/ldproxy.zip" && \
44+
unzip "${HOME}/.cargo/bin/ldproxy.zip" -d "${HOME}/.cargo/bin/" && \
45+
rm "${HOME}/.cargo/bin/ldproxy.zip" && \
46+
chmod u+x "${HOME}/.cargo/bin/ldproxy" && \
47+
curl -L "https://github.com/esp-rs/esp-web-flash-server/releases/latest/download/web-flash-${ARCH}.zip" -o "${HOME}/.cargo/bin/web-flash.zip" && \
48+
unzip "${HOME}/.cargo/bin/web-flash.zip" -d "${HOME}/.cargo/bin/" && \
49+
rm "${HOME}/.cargo/bin/web-flash.zip" && \
50+
chmod u+x "${HOME}/.cargo/bin/web-flash"
51+
52+
# Install Xtensa Rust
53+
RUN if [ -n "${GITHUB_TOKEN}" ]; then export GITHUB_TOKEN=${GITHUB_TOKEN}; fi \
54+
&& ${HOME}/.cargo/bin/espup install\
55+
--targets "${ESP_BOARD}" \
56+
--log-level debug \
57+
--export-file /home/${CONTAINER_USER}/export-esp.sh
58+
59+
# Set default toolchain
60+
RUN rustup default esp
61+
62+
63+
# Activate ESP environment
64+
RUN echo "source /home/${CONTAINER_USER}/export-esp.sh" >> ~/.bashrc
65+
66+
CMD [ "/bin/bash" ]
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{
2+
"name": "hangulclock_rs",
3+
// Select between image and build propieties to pull or build the image.
4+
// "image": "docker.io/espressif/idf-rust:esp32s2_latest",
5+
"build": {
6+
"dockerfile": "Dockerfile",
7+
"args": {
8+
"CONTAINER_USER": "esp",
9+
"CONTAINER_GROUP": "esp",
10+
"ESP_BOARD": "esp32s2"
11+
}
12+
},
13+
// https://github.com/serialport/serialport-rs/issues/153
14+
"runArgs": [
15+
"--mount",
16+
"type=bind,source=/run/udev,target=/run/udev,readonly"
17+
],
18+
"customizations": {
19+
"vscode": {
20+
"settings": {
21+
"editor.formatOnPaste": true,
22+
"editor.formatOnSave": true,
23+
"editor.formatOnSaveMode": "file",
24+
"editor.formatOnType": true,
25+
"lldb.executable": "/usr/bin/lldb",
26+
"files.watcherExclude": {
27+
"**/target/**": true
28+
},
29+
"rust-analyzer.checkOnSave.command": "clippy",
30+
"rust-analyzer.checkOnSave.allTargets": false,
31+
"[rust]": {
32+
"editor.defaultFormatter": "rust-lang.rust-analyzer"
33+
}
34+
},
35+
"extensions": [
36+
"rust-lang.rust-analyzer",
37+
"tamasfe.even-better-toml",
38+
"serayuzgur.crates",
39+
"mutantdino.resourcemonitor",
40+
"yzhang.markdown-all-in-one",
41+
"ms-vscode.cpptools",
42+
"actboy168.tasks",
43+
"Wokwi.wokwi-vscode"
44+
]
45+
}
46+
},
47+
"forwardPorts": [
48+
3333,
49+
8000
50+
],
51+
"workspaceMount": "source=${localWorkspaceFolder},target=/home/esp/hangulclock_rs,type=bind,consistency=cached",
52+
"workspaceFolder": "/home/esp/hangulclock_rs"
53+
}

0 commit comments

Comments
 (0)