From b43bd7d20d0e15aa37d30348126ffef3e5c6ff30 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Wed, 29 Aug 2018 14:23:25 +0200 Subject: [PATCH 1/4] deduplicate the contents .cargo/config using `cfg`s. Also add all the possible compilation targets to .cargo/config. --- .cargo/config | 46 +++++++--------------------------------------- 1 file changed, 7 insertions(+), 39 deletions(-) diff --git a/.cargo/config b/.cargo/config index b84a4d2..f2af1fc 100644 --- a/.cargo/config +++ b/.cargo/config @@ -1,4 +1,4 @@ -[target.thumbv6m-none-eabi] +[target.'cfg(all(target_arch = "arm", target_os = "none"))'] runner = 'arm-none-eabi-gdb' rustflags = [ # LLD (shipped with the Rust toolchain) is used as the default linker @@ -16,41 +16,9 @@ rustflags = [ # "-C", "link-arg=-nostartfiles", ] -[target.thumbv7m-none-eabi] -runner = 'arm-none-eabi-gdb' -rustflags = [ - # the comments under `[target.thumbv6m-none-eabi]` also apply here - "-C", "link-arg=-Tlink.x", - - # "-C", "linker=arm-none-eabi-ld", - - # "-C", "linker=arm-none-eabi-gcc", - # "-C", "link-arg=-Wl,-Tlink.x", - # "-C", "link-arg=-nostartfiles", -] - -[target.thumbv7em-none-eabi] -runner = 'arm-none-eabi-gdb' -rustflags = [ - # the comments under `[target.thumbv6m-none-eabi]` also apply here - "-C", "link-arg=-Tlink.x", - - # "-C", "linker=arm-none-eabi-ld", - - # "-C", "linker=arm-none-eabi-gcc", - # "-C", "link-arg=-Wl,-Tlink.x", - # "-C", "link-arg=-nostartfiles", -] - -[target.thumbv7em-none-eabihf] -runner = 'arm-none-eabi-gdb' -rustflags = [ - # the comments under `[target.thumbv6m-none-eabi]` also apply here - "-C", "link-arg=-Tlink.x", - - # "-C", "linker=arm-none-eabi-ld", - - # "-C", "linker=arm-none-eabi-gcc", - # "-C", "link-arg=-Wl,-Tlink.x", - # "-C", "link-arg=-nostartfiles", -] +[build] +# Pick one of these compilation targets +# target = "thumbv6m-none-eabi" +# target = "thumbv7m-none-eabi" +# target = "thumbv7em-none-eabi" +# target = "thumbv7em-none-eabihf" \ No newline at end of file From 065efc83fbf5163d15a0b8dc1ba09aad60787d07 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Wed, 29 Aug 2018 14:26:24 +0200 Subject: [PATCH 2/4] be explicit about the GDB script to use with this change the user doesn't need to set an [auto-load-safe-path] [auto-load-safe-path]: https://sourceware.org/gdb/onlinedocs/gdb/Auto_002dloading-safe-path.html --- .cargo/config | 2 +- .gdbinit => debug.gdb | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename .gdbinit => debug.gdb (100%) diff --git a/.cargo/config b/.cargo/config index f2af1fc..82b1da2 100644 --- a/.cargo/config +++ b/.cargo/config @@ -1,5 +1,5 @@ [target.'cfg(all(target_arch = "arm", target_os = "none"))'] -runner = 'arm-none-eabi-gdb' +runner = 'arm-none-eabi-gdb -x debug.gdb' rustflags = [ # LLD (shipped with the Rust toolchain) is used as the default linker "-C", "link-arg=-Tlink.x", diff --git a/.gdbinit b/debug.gdb similarity index 100% rename from .gdbinit rename to debug.gdb From 98137712a5afb6c3fe7eaf8732f5252c4dbce69b Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Wed, 29 Aug 2018 14:58:51 +0200 Subject: [PATCH 3/4] workaround rust-lang/cargo#5946 --- .cargo/config | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/.cargo/config b/.cargo/config index 82b1da2..78ede9d 100644 --- a/.cargo/config +++ b/.cargo/config @@ -1,5 +1,5 @@ [target.'cfg(all(target_arch = "arm", target_os = "none"))'] -runner = 'arm-none-eabi-gdb -x debug.gdb' +# runner = 'arm-none-eabi-gdb -x debug.gdb' rustflags = [ # LLD (shipped with the Rust toolchain) is used as the default linker "-C", "link-arg=-Tlink.x", @@ -16,6 +16,20 @@ rustflags = [ # "-C", "link-arg=-nostartfiles", ] +# work around rust-lang/cargo#5946 +[target.thumbv6m-none-eabi] +runner = 'arm-none-eabi-gdb -x debug.gdb' + +[target.thumbv7m-none-eabi] +runner = 'arm-none-eabi-gdb -x debug.gdb' + +[target.thumbv7em-none-eabi] +runner = 'arm-none-eabi-gdb -x debug.gdb' + +[target.thumbv7em-none-eabihf] +runner = 'arm-none-eabi-gdb -x debug.gdb' +# end of workaround + [build] # Pick one of these compilation targets # target = "thumbv6m-none-eabi" From 4265e01ef7554b3a8e6e423d089b19723b92d648 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Wed, 29 Aug 2018 16:55:50 +0200 Subject: [PATCH 4/4] add a comment indicating which core each target maps to --- .cargo/config | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.cargo/config b/.cargo/config index 78ede9d..d5176c3 100644 --- a/.cargo/config +++ b/.cargo/config @@ -32,7 +32,7 @@ runner = 'arm-none-eabi-gdb -x debug.gdb' [build] # Pick one of these compilation targets -# target = "thumbv6m-none-eabi" -# target = "thumbv7m-none-eabi" -# target = "thumbv7em-none-eabi" -# target = "thumbv7em-none-eabihf" \ No newline at end of file +# target = "thumbv6m-none-eabi" # Cortex-M0 and Cortex-M0+ +# target = "thumbv7m-none-eabi" # Cortex-M3 +# target = "thumbv7em-none-eabi" # Cortex-M4 and Cortex-M7 (no FPU) +# target = "thumbv7em-none-eabihf" # Cortex-M4F and Cortex-M7F (with FPU) \ No newline at end of file