From: Borja F. <bor...@gm...> - 2012-03-13 00:10:30
|
I've started to work in adding support for storing data in flash memory. As we discussed a year ago the best approach is to use named adress spaces and clang and llvm supports them. During the weekend I've been working to store the variables in the .progmem.data section. By default all static variables are declared in assembly using the .comm directive, so I had to change the way this works to save them in the mentioned section. Unfortunately I couldn't find a way to do this without patching a file that is target independent. Having this solved, or atleast for now if something else pops, I would like to add some sanity checks in the frontend for bad usage of using flash variables. Again, I think this will mean patching target independent files of clang, but I can't find a better way of doing it, I'm open to suggestions if anybody finds a way of avoiding this. The first checks I can think of is to force users to declare flash variables with the const qualifier, and pointers that point to flash memory to be const. Another one would be to error when writing a flash variable (only initialization is allowed). One could cast away the const and write to the var so this would have to be checked. On what other things should we check for? Btw, if somebody wants to work on this, I could move to the codegen side. |