[PATCH] D115982: [clang][AVR] Implement '__flashN' for variables on different flash banks

Ayke via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 3 12:32:38 PST 2022


aykevl added a comment.

avr-gcc checks whether the device supports the flash bank used. For example:

  $ cat test.c
  int d = 5;
  const int ro = 5;
  __flash const int f = 5;
  __flash1 const int f1 = 5;
  __flash2 const int f2 = 5;
  
  $ avr-gcc -mmcu=attiny84 -Os -c -o test.o test.c
  test.c:4:20: error: variable ‘f1’ located in address space ‘__flash1’ beyond flash of 64 KiB
   __flash1 const int f1 = 5;
                      ^
  test.c:5:20: error: variable ‘f2’ located in address space ‘__flash2’ beyond flash of 64 KiB
   __flash2 const int f2 = 5;
                      ^

It does not appear that this patch has a similar check, while I think that would be useful. Or did you leave it out intentionally?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115982/new/

https://reviews.llvm.org/D115982



More information about the cfe-commits mailing list