??? 09/07/07 08:27 Read: times |
#144116 - cooking C-header files to generate ctl files? Responding to: ???'s previous message |
>I've been toying with the idea of having a text file (somewhat like the control file) that would be read at runtime to set up the SFR names.
You could use the file compiler.h mentioned here: http://www.8052.com/forum/read.phtml?id=116161 to at least achieve part of this. And thus make use of a _shared_ header file for both C and D52:) How to? Fetch compiler.h and cc2430.h from here: http://sdcc.svn.sourceforge.net/viewvc/sd...ude/mcs51/ and put them in one directory. Then add this snippet: /** D52 disassembler * http://www.8052.com/users/disasm/ */ #elif defined __D52__ # define SBIT(name, addr, bit) k addr + bit name ; # define SFR(name, addr) f addr name # define SFRX(name, addr) s addr name # define SFR16(name, addr) s addr name # define SFR16E(name, fulladdr) ; not supported # define SFR32(name, addr) s addr name # define SFR32E(name, fulladdr) ; not supportedinto compiler.h . If you then run a C-preprocessor over the header file (taking gcc here, but others should be fine too) gcc -E cc2430.h -I. -D__D52__=1 the header file is processed to: # 1 "./compiler.h" 1 # 30 "cc2430.h" 2 # 54 "cc2430.h" f 0x80 P0; k 0x80 + 0 P0_0 ;; k 0x80 + 1 P0_1 ;; k 0x80 + 2 P0_2 ;; k 0x80 + 3 P0_3 ;; k 0x80 + 4 P0_4 ;; k 0x80 + 5 P0_5 ;; k 0x80 + 6 P0_6 ;; k 0x80 + 7 P0_7 ;; f 0x81 SP; f 0x82 DPL0; f 0x83 DPH0; f 0x84 DPL1; f 0x85 DPH1; [..] s 0xDF02 MDMCTRL0H; s 0xDF03 MDMCTRL0L; s 0xDF04 MDMCTRL1H; s 0xDF05 MDMCTRL1L; s 0xDF06 RSSIH; [..] Apparently I obmitted some of the 381 lines:) >along with the patch to allow decimal numbers in the control file. (using '#' as prefix for decimal notation would upset the C-preprocessor.) Greetings, Frieder |
Topic | Author | Date |
D52 v3.4.1 | 01/01/70 00:00 | |
Thanks! | 01/01/70 00:00 | |
and decimal? | 01/01/70 00:00 | |
Bug ?? | 01/01/70 00:00 | |
T3 | 01/01/70 00:00 | |
80c552 | 01/01/70 00:00 | |
the struct sfrentry sfr[128] | 01/01/70 00:00 | |
the real stuff would be... | 01/01/70 00:00 | |
SFRs | 01/01/70 00:00 | |
Do you think this is better... | 01/01/70 00:00 | |
cooking C-header files to generate ctl files?![]() | 01/01/70 00:00 |