我想编写一个简单的程序并为atmega16编译它。如何添加atmega16作为编译目标?几乎没有这方面的文件..。
谢谢
发布于 2022-11-27 06:21:09
唯一内置的AVR目标是avr-未知-gnu-atmega328 328。如果您使用的是不同的AVR微控制器,则需要一个自定义目标。
AVR-Rust Guidebook描述了如何为不同的AVR微控制器添加自定义目标。这一过程归结为:
鲁斯克-打印目标-规格-json -Z不稳定-选项-目标avr-未知-gnu-atmega328 328> avr-unknown-gnu-atmega16.json
"cpu":"atmega16","is-builtin":false,"-mmcu=atmega16“
注:
- The CPU is specified as "atmega16" not "atmega16p" as you had attempted to use
- I don't have any atmega16 MCU to hand so I have not been able to test the resulting binary. You may need to tweak other elements of the file.
- You will also need to install `avr-gcc`, as Rust uses it to link the resulting binary. You can get that [here](https://www.microchip.com/en-us/tools-resources/develop/microchip-studio/gcc-compilers).然后,您应该能够像这样构建您的项目:
货物构建-Z build-std=core ./avr-未知-gnu-atmega16.json-发布
注意,--target被指定为JSON文件的路径。如果在同一目录中,前缀为./.
https://stackoverflow.com/questions/74566557
复制相似问题