On Thu, 21 Jul 2016 22:01:40 +1000 Erik Christiansen <dva...@internode.on.net> wrote:
> I wouldn't go to the trouble of a C program, but do it with a lot less > lines of awk, but that's just taste. That's not going to help. E.g. on the tiny841, #define LFUSE_DEFAULT (FUSE_SUT_CKSEL0 & FUSE_SUT_CKSEL2 & \ FUSE_SUT_CKSEL3 & FUSE_SUT_CKSEL4 & FUSE_CKDIV8) #define HFUSE_DEFAULT (FUSE_SPIEN) #define EFUSE_DEFAULT (0xFF) That doesn't help directly, as you need to know the values of those individual FUSE_* constants. OK, so they are: #define FUSE_SUT_CKSEL0 (unsigned char)~_BV(0) #define FUSE_SUT_CKSEL1 (unsigned char)~_BV(1) #define FUSE_SUT_CKSEL2 (unsigned char)~_BV(2) #define FUSE_SUT_CKSEL3 (unsigned char)~_BV(3) #define FUSE_SUT_CKSEL4 (unsigned char)~_BV(4) ... Alright. Um we're going to need _BV(). Except that isn't found in this file. I'll have to follow the #include chain. So now I need to understand how #include works. And #define. And *then* I'm going to have to understand the ~ and & operators, along with the << operator of _BV's actual definition. Or; I could just generate/compile/run the following C program: #include <avr/io.h> printf("lfuse=%02x:hfuse=%02x:efuse=%02x\n", LFUSE_DEFAULt, HFUSE_DEFAULT, EFUSE_DEFAULT); and out comes the answer directly without my having to do any other work. Big spoiler: I already wrote lots of code for doing exactly this kind of "please get me values out of system .h files": https://metacpan.org/pod/ExtUtils::H2PM So in practice I'll just be running that. -- Paul "LeoNerd" Evans leon...@leonerd.org.uk | https://metacpan.org/author/PEVANS http://www.leonerd.org.uk/ | https://www.tindie.com/stores/leonerd/
pgpdOj4zkdtj1.pgp
Description: OpenPGP digital signature
_______________________________________________ AVR-GCC-list mailing list AVR-GCC-list@nongnu.org https://lists.nongnu.org/mailman/listinfo/avr-gcc-list