Skip to content

Commit

Permalink
Remove atomics usage to follow qingke recent changes (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
romainreignier authored Nov 17, 2024
1 parent 92d4b78 commit cec07b8
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 18 deletions.
9 changes: 5 additions & 4 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
{% if mcu_family == "ch32v003" or mcu_family == "ch641" -%}
[build]
{% if target == "riscv32ec-unknown-none-elf" -%}
target = "riscv32ec-unknown-none-elf.json"
{%- elsif target == "riscv32imfc-unknown-none-elf" -%}
target = "riscv32imfc-unknown-none-elf.json"
{%- else -%}
[build]
target = "{{ target }}"
{%- endif %}

[target."{{ target }}"]
runner = "wlink -v flash --enable-sdi-print --watch-serial"

{% if mcu_family == "ch32v003" or mcu_family == "ch641" -%}
{% if target == "riscv32ec-unknown-none-elf" or target == "riscv32imfc-unknown-none-elf" -%}
[unstable]
build-std = ["core"]
{% endif %}
{% endif -%}
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ embassy-executor = { version = "0.6.1", features = [
"task-arena-size-128", # or better use nightly, but fails on recent Rust versions
] }
embassy-time = { version = "0.3.0" }
qingke-rt = "0.4.0"
qingke = "0.4.0"
qingke-rt = "0.5.0"
qingke = "0.5.0"
embedded-hal = "1.0.0"
panic-halt = "1.0.0"

Expand Down
7 changes: 5 additions & 2 deletions cargo-generate.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[template]
cargo_generate_version = ">=0.19"
ignore = [".git", "README.md"]
ignore = [".git", ".github", "README.md"]

[hooks]
pre = ["pre-script.rhai"]
Expand All @@ -24,9 +24,12 @@ choices = [
]
default = "ch32v003"

[conditional.'mcu_family != "ch32v003 || mcu_family != "ch641"']
[conditional.'mcu_family != "ch32v003" && mcu_family != "ch641"']
ignore = ["riscv32ec-unknown-none-elf.json"]

[conditional.'mcu_family != "ch32v303" && mcu_family != "ch32v305" && mcu_family != "ch32v307"']
ignore = ["riscv32imfc-unknown-none-elf.json"]

[conditional.'mcu_family == "ch32l003"'.placeholders]
mcu = { type = "string", prompt = "Which ch32l003 variant to use?", choices = [
"ch32l103c8t6",
Expand Down
19 changes: 10 additions & 9 deletions pre-script.rhai
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
let targets = #{
ch32l003: "riscv32imac-unknown-none-elf",
ch32l003: "riscv32imc-unknown-none-elf",
ch32v003: "riscv32ec-unknown-none-elf",
ch32v103: "riscv32imac-unknown-none-elf",
ch32v203: "riscv32imac-unknown-none-elf",
ch32v208: "riscv32imac-unknown-none-elf",
ch32v303: "riscv32imafc-unknown-none-elf",
ch32v305: "riscv32imafc-unknown-none-elf",
ch32v307: "riscv32imafc-unknown-none-elf",
ch32x033: "riscv32imac-unknown-none-elf",
ch32x035: "riscv32imac-unknown-none-elf",
ch32v103: "riscv32imc-unknown-none-elf",
ch32v203: "riscv32imc-unknown-none-elf",
ch32v208: "riscv32imc-unknown-none-elf",
ch32v303: "riscv32imfc-unknown-none-elf",
ch32v305: "riscv32imfc-unknown-none-elf",
ch32v307: "riscv32imfc-unknown-none-elf",
ch32x033: "riscv32imc-unknown-none-elf",
ch32x035: "riscv32imc-unknown-none-elf",
ch641: "riscv32ec-unknown-none-elf",
};

let mcu_family = variable::get("mcu_family");
Expand Down
19 changes: 19 additions & 0 deletions riscv32imfc-unknown-none-elf.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"arch": "riscv32",
"atomic-cas": false,
"cpu": "generic-rv32",
"crt-objects-fallback": "false",
"data-layout": "e-m:e-p:32:32-i64:64-n32-S128",
"eh-frame-header": false,
"emit-debug-gdb-scripts": false,
"features": "+m,+f,+c,+forced-atomics",
"is-builtin": false,
"linker": "rust-lld",
"linker-flavor": "gnu-lld",
"llvm-abiname": "ilp32f",
"llvm-target": "riscv32",
"max-atomic-width": 32,
"panic-strategy": "abort",
"relocation-model": "static",
"target-pointer-width": "32"
}
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[toolchain]
channel = "nightly"
{% if mcu_family != "ch32v003" and mcu_family != "ch641" -%}
{% if target != "riscv32ec-unknown-none-elf" and target != "riscv32imfc-unknown-none-elf" -%}
targets = ["{{ target }}"]
{%- endif %}

0 comments on commit cec07b8

Please sign in to comment.