rust-embedded/discovery

Building on f3discovery root directory

pat0026 opened this issue · 1 comments

I have read the following note:

NOTE Make sure you are in the src/05-led-roulette directory and run cargo build command below to create the executable

But I was trying to build led-roulette on the f3discovery root directory by utilizing the package parameter with the following command:

cargo build -p "led-roulette" --target thumbv7em-none-eabihf --verbose

I noticed that the -C link-arg=-Tlink.x wasn't added to the options in the build command even though it is already on the discovery/f3discovery/src/.cargo/config.toml.

Built on discovery/f3discovery (no -C link-arg=-Tlink.x):

Running rustc --crate-name led_roulette --edition=2018 src\05-led-roulette\src\main.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 -C metadata=7d72679e334c868e -C extra-filename=-7d72679e334c868e --out-dir C:\Exploration\repo\github\discovery\f3discovery\target\thumbv7em-none-eabihf\debug\deps --target thumbv7em-none-eabihf -C incremental=C:\Exploration\repo\github\discovery\f3discovery\target\thumbv7em-none-eabihf\debug\incremental -L dependency=C:\Exploration\repo\github\discovery\f3discovery\target\thumbv7em-none-eabihf\debug\deps -L dependency=C:\Exploration\repo\github\discovery\f3discovery\target\debug\deps --extern aux5=C:\Exploration\repo\github\discovery\f3discovery\target\thumbv7em-none-eabihf\debug\deps\libaux5-dfde45e794eed34e.rlib -L C:\Exploration\repo\github\discovery\f3discovery\target\thumbv7em-none-eabihf\debug\build\cortex-m-59c645a98028bcaf\out -L C:\Exploration\repo\github\discovery\f3discovery\target\thumbv7em-none-eabihf\debug\build\cortex-m-rt-7e28cab60c2b1714\out -L C:\Exploration\repo\github\discovery\f3discovery\target\thumbv7em-none-eabihf\debug\build\stm32f3-discovery-d720e4e7f63df0be\out -L C:\Exploration\repo\github\discovery\f3discovery\target\thumbv7em-none-eabihf\debug\build\stm32f3-c8f3c2ed2f4bb62e\out

Built on discovery/f3discovery/src/05-led-roulette (has -C link-arg=-Tlink.x):

Running rustc --crate-name led_roulette --edition=2018 src\05-led-roulette\src\main.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 -C metadata=7d72679e334c868e -C extra-filename=-7d72679e334c868e --out-dir C:\Exploration\repo\github\discovery\f3discovery\target\thumbv7em-none-eabihf\debug\deps --target thumbv7em-none-eabihf -C incremental=C:\Exploration\repo\github\discovery\f3discovery\target\thumbv7em-none-eabihf\debug\incremental -L dependency=C:\Exploration\repo\github\discovery\f3discovery\target\thumbv7em-none-eabihf\debug\deps -L dependency=C:\Exploration\repo\github\discovery\f3discovery\target\debug\deps --extern aux5=C:\Exploration\repo\github\discovery\f3discovery\target\thumbv7em-none-eabihf\debug\deps\libaux5-dfde45e794eed34e.rlib -C link-arg=-Tlink.x -L C:\Exploration\repo\github\discovery\f3discovery\target\thumbv7em-none-eabihf\debug\build\cortex-m-59c645a98028bcaf\out -L C:\Exploration\repo\github\discovery\f3discovery\target\thumbv7em-none-eabihf\debug\build\cortex-m-rt-7e28cab60c2b1714\out -L C:\Exploration\repo\github\discovery\f3discovery\target\thumbv7em-none-eabihf\debug\build\stm32f3-discovery-d720e4e7f63df0be\out -L C:\Exploration\repo\github\discovery\f3discovery\target\thumbv7em-none-eabihf\debug\build\stm32f3-c8f3c2ed2f4bb62e\out

I would like to know the reason why this is and how to build on the root directory with different members like f3discovery. I might try to organize my personal project that is closely related to each other in this way on my embedded journey. Or is this a limitation of the cargo build?

I found the answer to my question and would like to share it here.
I needed to move the .cargo directory under src to the root directory.
From ./src/.cargo to ./.cargo.

Please see the following documentation as a reference:
hierarchical-structure