From: Alan C. de A. <ac...@gm...> - 2007-11-03 17:55:07
|
Hi, I'm trying to compile PICos18 (http://www.picos18.com) using SDCC, but I'm getting some problems: + "/usr/local/bin/sdcpp" -nostdinc -Wall -std=c99 -I"/home/alan/pic/picos18/" -Dpic18f2680 -D__18f2680 -DSTACK_MODEL_SMALL -obj-ext=.o -DSDCC_MODEL_SMALL -DSDCC=274 -DSDCC_pic16 -D__pic16 -I"/usr/local/bin/../share/sdcc/include/pic16" -I"/usr/local/share/sdcc/include/pic16" -I"/home/alan/pic/picos18/" "alarm.c" pro_man.h:61: token -> 'const' ; column 17 Looking at line: typedef rom const struct _rom_desc_tsk { unsigned char prioinit; unsigned char *stackAddr; void (*addr_ROM)(void); unsigned char tskstate; unsigned char tskid; unsigned int stksize; } rom_desc_tsk; I just removed the word rom to "solve" the problem. But I don't know what is the right way to solve it. There is some tutorial with tips helping people moving from C18 to SDCC ? Does someone here tried to compile PICos18 or other RTOS using SDCC? Cheers, Alan |
From: Raphael N. <rn...@we...> - 2007-11-03 18:32:35
|
Hi Alan, this is not a bug: You simply cannot declare constant types (does not make too much sense either...). Try typedef struct _rom_desc_tsk { // remainder } rom_desc_tsk; and define (constant) variables via const rom_desc_tsk foobar; Above code is untested but should work fine. Good luck, Raphael |
From: Alan C. de A. <ac...@gm...> - 2007-11-05 10:50:37
|
Hi Raphael, first thanks for your reply, 2007/11/3, Raphael Neider <rn...@we...>: > Hi Alan, > > this is not a bug: You simply cannot declare constant types (does not > make too much sense either...). Try > > typedef struct _rom_desc_tsk > { > // remainder > } rom_desc_tsk; > > and define (constant) variables via > > const rom_desc_tsk foobar; > The problem is not the "const" as the error message suggest, the problem is the "rom" before it. This code works fine: typedef const struct _rom_desc_tsk { unsigned char prioinit; ... } rom_desc_tsk; I agree with you the best way is just "typedefining" the struct and using const when declaring the variable, anyway this code is not mine, I want just compile it using SDCC :-D How can I define the "rom" word using SDCC ? > Above code is untested but should work fine. > > Good luck, > Raphael > Thank you, Alan |
From: Raphael N. <rn...@we...> - 2007-11-05 13:15:01
|
Hi Alan, > The problem is not the "const" as the error message suggest, the > problem is the "rom" before it. > > This code works fine: > > typedef const struct _rom_desc_tsk > { > unsigned char prioinit; > ... > } rom_desc_tsk; As indeed it should according to the ANSI C specification... I just guessed that you had removed the rom keyword and it still did not work. > I agree with you the best way is just "typedefining" the struct and > using const when declaring the variable, anyway this code is not mine, > I want just compile it using SDCC :-D > > How can I define the "rom" word using SDCC ? Well, you could use #define rom /* ignored */ or (probably semantically closer) #define rom __code prior to the declarations. The latter allocates the constant struct in code memory (Flash or EEPROM). Better luck this time, Raphael |
From: Alan C. de A. <ac...@gm...> - 2007-11-06 14:36:07
|
Hi Raphael, 2007/11/5, Raphael Neider <rn...@we...>: > Hi Alan, > > > The problem is not the "const" as the error message suggest, the > > problem is the "rom" before it. > > > > This code works fine: > > > > typedef const struct _rom_desc_tsk > > { > > unsigned char prioinit; > > ... > > } rom_desc_tsk; > > As indeed it should according to the ANSI C specification... I just > guessed that you had removed the rom keyword and it still did not work. > > > I agree with you the best way is just "typedefining" the struct and > > using const when declaring the variable, anyway this code is not mine, > > I want just compile it using SDCC :-D > > > > How can I define the "rom" word using SDCC ? > > Well, you could use > #define rom /* ignored */ > or (probably semantically closer) > #define rom __code > prior to the declarations. The latter allocates the constant struct in > code memory (Flash or EEPROM). > wow, it solve this error! I found much more errors, but solved everyone until now. I just don't know how to solve this one: PICos18.asm:50: error: Symbol not previously defined (TBLPTRU). PICos18.asm:51: error: Symbol not previously defined (__FPFLAGS). If I declare "#extern TBLPTRU" it solve the problema, but it will appear at linkage stage. > Better luck this time, Thank you very much, > Raphael > Alan |