[clang] [llvm] [AVR] Handle flash RO data mapped to data space for newer devices (PR #146244)
Ben Shi via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 2 17:52:10 PDT 2025
================
@@ -651,8 +651,19 @@ void AVR::Linker::ConstructJob(Compilation &C, const JobAction &JA,
// This is almost always required because otherwise avr-ld
// will assume 'avr2' and warn about the program being larger
// than the bare minimum supports.
- if (Linker.find("avr-ld") != std::string::npos && FamilyName)
- CmdArgs.push_back(Args.MakeArgString(std::string("-m") + *FamilyName));
+ if (Linker.find("avr-ld") != std::string::npos && FamilyName) {
+ // Option to use mapped memory for modern devices with >32kB flash.
+ // This is the only option for modern devices with <= 32kB flash,
+ // but the larger default to a copy from flash to RAM (avr-ld version < 14)
+ // or map the highest 32kB to RAM (avr-ld version >= 14).
+ if (Args.hasFlag(options::OPT_mflmap, options::OPT_mrodata_in_ram, false)) {
+ CmdArgs.push_back(
+ Args.MakeArgString(std::string("-m") + *FamilyName + "_flmap"));
----------------
benshi001 wrote:
I agree, so I think I need more time to understand the whole picture what gcc did.
https://github.com/llvm/llvm-project/pull/146244
More information about the llvm-commits
mailing list