Open xd009642 opened 2 years ago
I got an entirely different set of linker shenanigans compiling that branch, unfortunately I don't have time to dig in right now :(
= note: rust-lld: error: /home/alex/git/llvm-embedded-coverage/target/thumbv7em-none-eabihf/debug/deps/libminicov-4c01edf3db0477f9.rlib(InstrProfiling.o) is incompatible with /home/alex/git/llvm-embedded-coverage/target/thumbv7em-none-eabihf/debug/deps/llvm_embedded_coverage-99dc7a9194551c00.3x19h158c8n8aufg.rcgu.o
rust-lld: error: /home/alex/git/llvm-embedded-coverage/target/thumbv7em-none-eabihf/debug/deps/libminicov-4c01edf3db0477f9.rlib(InstrProfilingBuffer.o) is incompatible with /home/alex/git/llvm-embedded-coverage/target/thumbv7em-none-eabihf/debug/deps/llvm_embedded_coverage-99dc7a9194551c00.3x19h158c8n8aufg.rcgu.o
rust-lld: error: /home/alex/git/llvm-embedded-coverage/target/thumbv7em-none-eabihf/debug/deps/libminicov-4c01edf3db0477f9.rlib(InstrProfilingMerge.o) is incompatible with /home/alex/git/llvm-embedded-coverage/target/thumbv7em-none-eabihf/debug/deps/llvm_embedded_coverage-99dc7a9194551c00.3x19h158c8n8aufg.rcgu.o
Is your cargo flash
/ cargo embed
up to date? I have had updates fix flashing problems before.
I'll try them in a bit. Were you setting the rust flags when building? RUSTFLAGS="-Zinstrument-coverage -Zno-profiler-runtime"
? Building works fine for me it's just it seems to not be laid out right for flashing.
The fact the llvm_prf_cnts and llvm_prf_data sections need to be r/w to record the coverage data might be a cause I'm thinking :thinking:
Tried updating them and no luck. I'm thinking it must not be seeing my memory.x for some reason because " 0x00010000.. 0x104e5." is not the memory region I want at all :|
I might have to shelve this for a bit if I don't make progress (at least until xmas holidays) it was kinda me procrastinating by working on something else instead of what I'm meant to be :sweat_smile:
I'll try them in a bit. Were you setting the rust flags when building?
RUSTFLAGS="-Zinstrument-coverage -Zno-profiler-runtime"
? Building works fine for me it's just it seems to not be laid out right for flashing.The fact the llvm_prf_cnts and llvm_prf_data sections need to be r/w to record the coverage data might be a cause I'm thinking thinking
Yeah, I am not sure why it is not compiling for me. Are you on a similar nightly version?
$ git rev-parse HEAD
5be608de4e35605b7537bffdf496df55c5311ad9
$ cargo +nightly --version
cargo 1.58.0-nightly (7f08ace4f 2021-11-24)
So there's only 2 days between our nightly versions... Let me update nightly and see if it builds
git rev-parse HEAD
5be608de4e35605b7537bffdf496df55c5311ad9
cargo +nightly --version
cargo 1.58.0-nightly (e1fb17631 2021-11-22)
I removed flip-link thinking it was down to https://github.com/knurling-rs/flip-link/issues/43 and then flashed it... But then I realised I forgot to set rustflags and then set them and it failed to flash. But apparently the binary is smaller - which shouldn't be the case as there should be more due to the coverage counter sections etc :thinking:
Without RUSTFLAGS="-Zinstrument-coverage -Zno-profiler-runtime"
text data bss dec hex filename
10892 8 9560 20460 4fec llvm-embedded-coverage
Sections:
Idx | Name | Size | VMA | LMA | File off | Algn |
---|---|---|---|---|---|---|
0 | .vector_table | 00000400 | 08000000 | 08000000 | 00010000 | 2**2 |
CONTENTS | ALLOC, LOAD, READONLY, DATA | |||||
1 | .text | 00002224 | 08000400 | 08000400 | 00010400 | 2**1 |
CONTENTS | ALLOC, LOAD, READONLY, CODE | |||||
2 | .rodata | 00000468 | 08002624 | 08002624 | 00012624 | 2**4 |
CONTENTS | ALLOC, LOAD, READONLY, DATA | |||||
3 | .data | 00000008 | 200001b8 | 08002a90 | 000201b8 | 2**3 |
CONTENTS | ALLOC, LOAD, DATA | |||||
4 | .bss | 00002558 | 200001c0 | 200001c0 | 000201c0 | 2**3 |
ALLOC | ||||||
5 | .uninit | 00000000 | 20002718 | 20002718 | 000201c0 | 2**2 |
ALLOC | ||||||
6 | .debug_loc | 000035ec | 00000000 | 00000000 | 000201c0 | 2**0 |
CONTENTS | READONLY, DEBUGGING | |||||
7 | .debug_abbrev | 000023d4 | 00000000 | 00000000 | 000237ac | 2**0 |
CONTENTS | READONLY, DEBUGGING | |||||
8 | .debug_info | 0002d864 | 00000000 | 00000000 | 00025b80 | 2**0 |
CONTENTS | READONLY, DEBUGGING | |||||
9 | .debug_aranges | 00002110 | 00000000 | 00000000 | 000533e8 | 2**3 |
CONTENTS | READONLY, DEBUGGING | |||||
10 | .debug_ranges | 0001a6b8 | 00000000 | 00000000 | 000554f8 | 2**0 |
CONTENTS | READONLY, DEBUGGING | |||||
11 | .debug_str | 00036ec2 | 00000000 | 00000000 | 0006fbb0 | 2**0 |
CONTENTS | READONLY, DEBUGGING | |||||
12 | .debug_pubnames | 0000f2ec | 00000000 | 00000000 | 000a6a72 | 2**0 |
CONTENTS | READONLY, DEBUGGING | |||||
13 | .debug_pubtypes | 0000222e | 00000000 | 00000000 | 000b5d5e | 2**0 |
CONTENTS | READONLY, DEBUGGING | |||||
14 | .ARM.attributes | 0000003a | 00000000 | 00000000 | 000b7f8c | 2**0 |
CONTENTS | READONLY | |||||
15 | .debug_frame | 0000705c | 00000000 | 00000000 | 000b7fc8 | 2**2 |
CONTENTS | READONLY, DEBUGGING | |||||
16 | .debug_line | 0002a89e | 00000000 | 00000000 | 000bf024 | 2**0 |
CONTENTS | READONLY, DEBUGGING | |||||
17 | .debug_macinfo | 00000007 | 00000000 | 00000000 | 000e98c2 | 2**0 |
CONTENTS | READONLY, DEBUGGING | |||||
18 | .comment | 000000a3 | 00000000 | 00000000 | 000e98c9 | 2**0 |
CONTENTS | READONLY |
With RUSTFLAGS="-Zinstrument-coverage -Zno-profiler-runtime"
text data bss dec hex filename
1688 3268 0 4956 135c target/thumbv7em-none-eabihf/debug/llvm-embedded-coverage
Sections:
Idx | Name | Size | VMA | LMA | File off | Algn |
---|---|---|---|---|---|---|
0 | .ARM.exidx | 00000010 | 00010134 | 00010134 | 00000134 | 2**2 |
CONTENTS | ALLOC, LOAD, READONLY, DATA | |||||
1 | __llvm_prf_names | 000003a2 | 00010144 | 00010144 | 00000144 | 2**0 |
CONTENTS | ALLOC, LOAD, READONLY, DATA | |||||
2 | .text | 000002e6 | 000204e6 | 000204e6 | 000004e6 | 2**1 |
CONTENTS | ALLOC, LOAD, READONLY, CODE | |||||
3 | .init_array | 00000014 | 000307cc | 000307cc | 000007cc | 2**2 |
CONTENTS | ALLOC, LOAD, DATA | |||||
4 | __llvm_prf_cnts | 00000490 | 000407e0 | 000407e0 | 000007e0 | 2**3 |
CONTENTS | ALLOC, LOAD, DATA | |||||
5 | __llvm_prf_data | 00000820 | 00040c70 | 00040c70 | 00000c70 | 2**3 |
CONTENTS | ALLOC, LOAD, DATA | |||||
6 | __llvm_covfun | 000009fa | 00000000 | 00000000 | 00001490 | 2**3 |
CONTENTS | READONLY | |||||
7 | __llvm_covmap | 000001cc | 00000000 | 00000000 | 00001e90 | 2**3 |
CONTENTS | READONLY | |||||
8 | .debug_loc | 00002ef3 | 00000000 | 00000000 | 0000205c | 2**0 |
CONTENTS | READONLY, DEBUGGING | |||||
9 | .debug_abbrev | 00002110 | 00000000 | 00000000 | 00004f4f | 2**0 |
CONTENTS | READONLY, DEBUGGING | |||||
10 | .debug_info | 0002bbcb | 00000000 | 00000000 | 0000705f | 2**0 |
CONTENTS | READONLY, DEBUGGING | |||||
11 | .debug_aranges | 000020a0 | 00000000 | 00000000 | 00032c30 | 2**3 |
CONTENTS | READONLY, DEBUGGING | |||||
12 | .debug_ranges | 0001a668 | 00000000 | 00000000 | 00034cd0 | 2**0 |
CONTENTS | READONLY, DEBUGGING | |||||
13 | .debug_str | 00037061 | 00000000 | 00000000 | 0004f338 | 2**0 |
CONTENTS | READONLY, DEBUGGING | |||||
14 | .debug_pubnames | 0000efef | 00000000 | 00000000 | 00086399 | 2**0 |
CONTENTS | READONLY, DEBUGGING | |||||
15 | .debug_pubtypes | 00001ed7 | 00000000 | 00000000 | 00095388 | 2**0 |
CONTENTS | READONLY, DEBUGGING | |||||
16 | .ARM.attributes | 00000038 | 00000000 | 00000000 | 0009725f | 2**0 |
CONTENTS | READONLY | |||||
17 | .debug_frame | 0000719c | 00000000 | 00000000 | 00097298 | 2**2 |
CONTENTS | READONLY, DEBUGGING | |||||
18 | .debug_line | 0002a639 | 00000000 | 00000000 | 0009e434 | 2**0 |
CONTENTS | READONLY, DEBUGGING | |||||
19 | .debug_macinfo | 00000007 | 00000000 | 00000000 | 000c8a6d | 2**0 |
CONTENTS | READONLY, DEBUGGING | |||||
20 | .comment | 000000a3 | 00000000 | 00000000 | 000c8a74 | 2**0 |
CONTENTS | READONLY |
Okay it flashes now, rustflags should have been in the .cargo/config to avoid overwriting some of the ones added by other things
On the
feat/make-no-std
when trying to flash my device I get:Now the binary is <1MB, and the flash of the chip I'm using is 2MB so it appears there's something wrong in my linker args or linker scripts. But it's been a good few years since I've touched rust embedded and nothing appears off to me...
@newAM have you had a chance to try this out and do you know how I could solve this? I've tried looking it up with cargo flash and cargo embed but not found anything helpful as of yet