Re: [Sdcc-user] PIC banking problems...

2008-09-07 Thread Raphael Neider
> I'm getting the error again. The problem is with a big array, but it is > declared as code, not data memory: > > __code unsigned char cod3[]={ OK, as I just found out, this also ends up in a section called ID_filename_number, which is, however, declared as code rather than idata... So you are

Re: [Sdcc-user] pic14 port alternative name

2008-09-07 Thread Raphael Neider
Hi Peter, > If I allow the linker to assign the location: > lcd_t lcd; > everything compiles fine. The lcd structure, is of course, not at the > port address. If I > volatile lcd_t __at (PORTB_ADDR); > I get an error saying "multiple sections using address 0x6" > > But, I can declare: > __sfr P

Re: [Sdcc-user] pic14 port alternative name

2008-09-07 Thread Raphael Neider
Hi Peter, > If I allow the linker to assign the location: > lcd_t lcd; > everything compiles fine. The lcd structure, is of course, not at the > port address. If I > volatile lcd_t __at (PORTB_ADDR); > I get an error saying "multiple sections using address 0x6" > > But, I can declare: > __sfr P

Re: [Sdcc-user] PIC18f4520; passing array to a function doesn't work

2008-10-16 Thread Raphael Neider
Hi Bastiaan, code char at __CONFIG4L _conf4 = _LVP_OFF_4L & _STVREN_ON_4L; You might need an additional _XINST_OFF_4L here to disable (!) extended instructions of the 4520 part. Good luck, Raphael - This SF.Net email i

Re: [Sdcc-user] pic18f4680 / 4550 strange behaviour when calling functions

2008-10-16 Thread Raphael Neider
> The following code works like a charm on a pic18f4550. > Output on the serial port is "A6A6A6A6A6A6A6A". > > Now compiling exactly the same source code (or even using the hex-file for > the 4550) for a pic18f4680 produces the following output: > "A???A???AACAsA£A???A" > The parameter '6' in tes

Re: [Sdcc-user] SPI problem on PIC18F2580

2008-10-20 Thread Raphael Neider
Hi Vaclav, > I already wrote to Microchip forum but the problem can be in SDCC as well. > The problem is that when I use "built-in SPI" read, I always get 0x00. But > with "manual SPI" I get correct result. > > I started to fight with the communication between PIC18f2580 and CC1100 in > SDCC vers

Re: [Sdcc-user] PIC16: Array defined within a function

2008-10-22 Thread Raphael Neider
Hi Alex, > I define an array inside a function. > Unfortunately, all the elements of the array initialized by 0x30, > instead of the given values. > > unsigned char conversion_by_table(unsigned char index) > { > unsigned char conversion_table[4] ={'0x01','0x02','0x03','0x04'}; > return conver

Re: [Sdcc-user] SDCC -mpic14 and TRISB_bits do not work ?

2008-11-20 Thread Raphael Neider
> Hello, I just found that direct TRISB6 = 0; works properly. Even if I > would like TRISBbits.TRISB6 = 0; as it is done for PIC16 port. Is there > any plans to synchronize it ? You can use #define NO_BIT_DEFINES 1 #include to disable bit defines, see the header files. NO_BIT_DEFINES must be

Re: [Sdcc-user] [ pic18f, simple program, no crt ]

2008-11-24 Thread Raphael Neider
> I am trying to make the following code > work when compiled by sdcc for pic18f4550 > with --no-crt. > > I take care not using stack, but I guess thi is > not a problem given the way sdcc works. > > It compiles, but at run time my led is not switched > on (the led works well) > > Could you tell m

Re: [Sdcc-user] [ pic18f, simple program, no crt ]

2008-11-26 Thread Raphael Neider
void foo (void) __naked { static int i = 0; static int j = 0; __asm clrf_TBLPTRU, 0 bsf 0xa6, 7, 0 bcf 0xa6, 6, 0 __endasm; ADCON1 = 0x0f; CMCON = 7; TRISA = 0; LATAbits.LATA0 = 1; LATAbits.LATA1 = 0; j = 0; for (; ; ) ; } This code would

Re: [Sdcc-user] Question about PIC18F4550

2008-12-14 Thread Raphael Neider
Hi, I had never used SDCC, and I have a project for pic18f4550 with CCS compiler. I use the USB communication over a serial emulation. How difficult it is translate this code for sdcc? H, depends... There is a (pretty old and not updated) migration guide available at http://particle.

Re: [Sdcc-user] PIC14 port - pic12f675.h TRISIO_bits missing + macro expansion

2008-12-16 Thread Raphael Neider
Hi Vaclav, I started to play with software I2C on 12F675 and found that TRISIO_bits definition is missing. Can somebody add following (or something similar) into pic12f675.h (and corresponding "volatile __TRISIO_bits_t .." line into .C file) ? Included in r5287; I also consolidated the de

Re: [Sdcc-user] Problem compiling device libraries for PIC16 on MacOS, help required?

2008-12-26 Thread Raphael Neider
> when I enter commands: > > cd device/lib/pic16 > ./configure > make During the configure-run you must have gpasm and gplink in your PATH (the configure script will tell you if it found them). In your case, gpasm has not been found. With /path/to/gpasm/gpasm being the installed gpasm tool, try

Re: [Sdcc-user] PIC14 - missing banksel for local variables ?

2008-12-29 Thread Raphael Neider
Hi Vaclav, > I am trying software I2C routines in SDCC for PIC16F676. Currently with no > success. So I played with bit-bang output and found some interesting feature > (honestly, I do not know if it is a bug or feature). It's a bug: There is a BANKSEL missing before 53. Fix committed as SDCC

Re: [Sdcc-user] popGet warning

2008-12-31 Thread Raphael Neider
Hi, > - syntax error in the line after the last one ??? > I could not repcroduce it normally, after commenting out almost > everything, it disappeard. While uncommenting it does not showed > again... :) It made me crazy for an hour searching for typhos. Without some source showing this behaviour

Re: [Sdcc-user] PIC18F4550 pointer performance

2009-01-08 Thread Raphael Neider
Hi, > I had quick peek at the generated code and noticed that pointer access > to a structure involved call to some support function to handle the > generic pointer. You could use __data pointers, which should be dereferenced inline. They are also only two bytes each and thus help reducing the co

Re: [Sdcc-user] PIC18F4550 Extended instruction set

2009-01-08 Thread Raphael Neider
Hi, > What does it mean, extended instruction set? Extended compared to what, > PIC16? Extended instruction set refers to additions and changes made to the interpretation of certain opcodes. According to the 4550 datasheet, Sect. 26-2, 8 instructions have been added (ADDFSR, ADDULNK, CALLW, MOVS

Re: [Sdcc-user] SDCC deleted .d files?

2009-01-15 Thread Raphael Neider
Hi Kusti, > After some tracking it seems that SDCC deletes file 'X.d' if I specify > output file with '-o X.o' > > Is this how it should work? Is this different from gcc? If so is it a > bug or feature? At least some SDCC targets (e.g., pic16) use .d files to output debug information (to debug

Re: [Sdcc-user] How to generete .map/.mem files with PIC port?

2009-01-18 Thread Raphael Neider
Hi, > But now I have a multifile PIC project and I cannot see the.map nor > .mem files anywhere. And I can't find a relevant command line option > to turn them on either. For the PIC ports (pic14 and pic16), the linker (gplink) is responsible for creating the .map files. You can call for them by

Re: [Sdcc-user] CIL + TinyOS

2009-01-19 Thread Raphael Neider
Hi, I cannot help you with the wrong behaviour, but the warnings are all correct but can probably safely be ignored. > The output from SDCC is: > app.c:45: warning 166: useless declaration (possible use of keyword as > variable name) > app.c:46: warning 166: useless declaration (possible use of k

Re: [Sdcc-user] __critical does nothing with PIC18F4550 ?

2009-01-20 Thread Raphael Neider
Hi, > But when I look at the compiled (assembler source code) I see no > difference with or without the __critical keyword nor any evidence > of any interrupt disabling code. > > So what am I doing wrong? Errr, nothing: __critical is not implemented for the PIC ports. You can partially emulate it

Re: [Sdcc-user] __critical does nothing with PIC18F4550 ?

2009-01-20 Thread Raphael Neider
Hi Kusti, > I'll test this later today. > > You wrote: "partially emulate" > > What do you mean by that, what __critical -functionality would > disabling all interrupt not emulate? Well, you cannot emulate void func(void) __critical { // something } using void func(void) { CRITICAL( //so

Re: [Sdcc-user] __critical does nothing with PIC18F4550 ?

2009-01-20 Thread Raphael Neider
Hi, > tested my code with CRITICAL macro. The macro works (tested that) > but it did not solve my issue, but I'll make an other post about that. > > BTW there is a small typo in the macro you sketched, you cannot > have a non const initializer for the static var, so I modified it as > follows: > >

Re: [Sdcc-user] PIC18F4550 HEX file created don't work.

2009-01-22 Thread Raphael Neider
Hi, > void main(void) > { > // make all pins of port A as outputs > TRISA = 0; > // Configure LCD_PORT if in use > TRISB = 0; > // Configure LCD control pins > TRISD = 0xF7; > > // Put all PORTA outputs to high > PORTA = 0xff; > > } You might

Re: [Sdcc-user] multiple IOCs on the same port - slightly offtopic

2009-01-22 Thread Raphael Neider
Hi, > void init_ports() > { > PORTA = 0; > PORTB = 0; > PORTC = 0; > > __asm > banksel PORTA > movfPORTA,W > movfPORTB,W > __endasm; > > ANSEL = ADC_CHANNEL_ANSEL; > ANSELH = 0; > > TRISA = 0xff; // all input > TRISB = OUT_TxD; > TRISC

Re: [Sdcc-user] PIC18F4550 Using larger variable / more memory

2009-01-24 Thread Raphael Neider
Hi, > it seems that when I define larger variable something still goes > wrong. How? What? Why? Where? Huh?!? > char largetestvar [100]; > > will cause the program to crash. Which program? What's crash supposed to mean: how do you observe that? > Changing that to: > char at 0x300 largetestvar

Re: [Sdcc-user] PIC18F4550 Using larger variable / more memory

2009-01-25 Thread Raphael Neider
Hi, > But when I started to add some functionality and increased the size > of my USART communication buffer, it crashes. I sometimes see > the printfed "Hello" from the program indicating that it starts, but > the PIC dies. Just a wild guess: You might want to check for stack overflow: Try addin

Re: [Sdcc-user] PIC18F4550 Using larger variables - more clues

2009-01-25 Thread Raphael Neider
Hi, > static volatile char xxx[19];=> static volatile char xxx[20]; > and with the value 19 it works and 20 it does not. This is an ideal situation for debugging. Good work. > So I took the diff of the maps produced by the compiler (see bottom): > > My guess is , seeing that I'm right at the

Re: [Sdcc-user] TCP/IP support for PIC18 - alledged SDCC shortcomings re PIC18

2009-01-28 Thread Raphael Neider
Hi, > threading, so couldn't cope with more than one request. I only really > need to know the syntax to recreate the packed structures. Unless the > structures are packed by default in SDCC. Structures are packed by default by sdcc. Why should they not be? We are talking about 8-bit micro, align

Re: [Sdcc-user] TCP/IP support for PIC18 - alledged SDCC shortcomings re PIC18

2009-01-28 Thread Raphael Neider
Hi, > with the PIC port. It looks to me like C18 is using some non standard C > for interrupts and data definitions, and I can't find info on how these If I recall correctly, some 'rom' modifier to place data structures into ... ROM ... translates to __code in sdcc. Interrupts are not covered

Re: [Sdcc-user] missing definition for symbol "_SSPBUF", required by "strmmssp.o"

2009-01-29 Thread Raphael Neider
Hi, > missing definition for symbol "_SSPBUF", required by "strmmssp.o" > Ok, so there is no SSPBUF in 4450 but I don't see where > __stream_mssp_putchar which refers to _SSPBUF > gets called? _SSPBUF is required by the MSSP putchar, referenced from stream_putchar, referenced from vfprintf, refe

Re: [Sdcc-user] missing definition for symbol "_SSPBUF", required by "strmmssp.o"

2009-02-01 Thread Raphael Neider
Hi, > Should I file a bug or not? No need to do that: I committed a workaroundish fix in SDCC r5352. Best regards, Raphael -- This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story.

Re: [Sdcc-user] sdcc -mpic16: how to reduce code ?

2009-02-02 Thread Raphael Neider
Hi, > I am working on PCB tester with programming capabilities for PIC - of > course in SDCC. I compile target.c, generated HEX is then processed into > .H file and linked together with code of the main application. Target > code is really simple, but it seems to me that overhead is quite bi

Re: [Sdcc-user] Instructions for building gpsim on Mac OS

2009-02-10 Thread Raphael Neider
Hi, > glibtoolize , aclocal and autoheader calls succeeds as far as I > understand > but automake fails as follows (snipped it, see the comple list at the > end of mail): > > nyholkumac2:trunk nyholku$ glibtoolize --force > You should update your `aclocal.m4' by running aclocal. > nyholkumac2:trun

Re: [Sdcc-user] sprintf function and float and int (pic16)

2009-02-10 Thread Raphael Neider
Hi Alexandre, > Please look in the manual under "Library Routines". It explains why > floating point support is disabled in printf by default and how to turn > it on. Unfortunately this is not (yet) true for the pic16 targets to which you were referring. Outputting float values was just not i

Re: [Sdcc-user] Pic14 port - maybe bug in INT addition ?

2009-02-21 Thread Raphael Neider
Hi, > Hello, I am fighting with 16f690 processor. I have two INT variables and > add them together. SDCC generates following code: Annotated for clarity, low byte in [0], high byte in [1]: > ; .line 349; "main.c" gYfilter = gYfilter + gYrotation; > BANKSEL _gYrotation > MOV

Re: [Sdcc-user] Larger than 256 byte arrays in PIC16

2009-02-25 Thread Raphael Neider
Hi Kustaa, Yes, this is sort of what I was looking for, but this did not completely answer the question. My array is not malloc'ated but is a global variable. I've not changed the default linker script and the compiler and linker seem to be happy. This is strange: The attached source should

Re: [Sdcc-user] [PATCH] pic16 port: pic18f452: defines bits for I/O ports and corresponding TRISx bits

2009-02-28 Thread Raphael Neider
Dear Abdoulaye, > This patch defines bits for PORT{A,B,C,D,E} and corresponding TRISx > configuration bits. > To disable bits definition, -DNO_BIT_DEFINES needs to be add at compile > time. > > Signed-off-by: Abdoulaye Walsimou Gaye > --- > sdcc/device/include/pic16/pic18f452.h | 98 > ++

Re: [Sdcc-user] PIC port, __naked not working, Bus error, signal 11: SIGSEGV

2009-03-09 Thread Raphael Neider
Hi Kusti, After a lot of pruning I got the code down to: unsigned char x; void test() __naked { if (x) { x = 1; } } Very good work; this helped a lot! which when compiled with parameters: SDCCFLAGS = "-Wl,-m,-s 18f4550.lkr" -mpic16 -p18f4550 \ --d

Re: [Sdcc-user] PIC14 - how to optimize code ?

2009-03-09 Thread Raphael Neider
Hi Vaclav, I have one application - some special type of headlamp driven by PIC12F675. The problem is that I can not fit into the memory. [snip] I use all functions static. Most of them is used on more places, so inlining is not the right way. My variables are as short as possible. But th

Re: [Sdcc-user] '--preplace-udata-with' => sdcc(6721) malloc: *** error for object 0x1eff1f: Non-aligned pointer being freed

2009-03-10 Thread Raphael Neider
Hi Kusti, > while trying to optimize my code I was trying to get the compiler > to place the internal variables into some non overlayed section with > the '--preplace-udata-with' command line option but in all circumstances > I've tried it results in one or more error messages of the following >

Re: [Sdcc-user] Small Device C Compiler 2.9.0 released

2009-03-22 Thread Raphael Neider
> A new release of SDCC, the portable optimizing compiler for 8051, > DS390, Z80, HC08, and PIC microprocessors is now available > (http://sdcc.sourceforge.net). Thank you, Borut, for managing the release! Hopefully this will give the SDCC users an even better experience/more desired features/l

Re: [Sdcc-user] BUG: Comparisons not working on a 16f877 PIC

2009-03-24 Thread Raphael Neider
Dear Néstor, > // This reads memory until it gets to the correct language. > for (i=0; i>language; i++) > { > while (text[0] != 0) > { > text[0] = SerialReadPostIncr(); > } > } Did you mean `for (i=0; i < language; i++)' with i LESS THAN language here?!? I did not even

Re: [Sdcc-user] Howto declare a global variable across pages in a 16f877 PIC?

2009-03-26 Thread Raphael Neider
Hi, >static BYTE language=I18N_ES; > > inside of a header (temete4.h), which is included from all the 4 > source files of the project: temete1.c, temete2.c, temete3.c & > temete4.c (you know, each one if for one page). > > The problem is that when I want to assign some value to "language" in >

Re: [Sdcc-user] PIC examples

2009-04-01 Thread Raphael Neider
> I couldn't find help on the __config word or any language reference. I > have looked in the Wiki but I have not found anything. You have to use something like (untested) static __code unsigned short __at(0x2007) _conf = _WDT_OFF & _BOR_OFF & _INTOSC; assuming that the config word is

Re: [Sdcc-user] Code optimisation conundrum...

2009-04-03 Thread Raphael Neider
> > Address=&MemoryBlock; > (*Address)=0xAA; > if ( (*Address) != 0xAA ) > { /* We never get here because the (*Address) location is not re-read > */ } > > I can declare the MemoryBlock variable as volatile [I have done], but > that > doesn't mean that the compiler knows that (*Addr

Re: [Sdcc-user] Error [115] Duplicate label or redefining symbol that cannot be redefined. (_$_000021)

2009-04-06 Thread Raphael Neider
Hi Nestor, > # sdcc -mpic14 -p16f877 --nooverlay > -I/usr/local/share/sdcc/include/pic/ -I/usr/local/share/sdcc/include/ > -c temete1.c > temete1.c:62: warning 85: in function PaintClockTest unreferenced > function argument : 'x' > temete1.c:62: warning 85: in function PaintClockTest unreferenced

Re: [Sdcc-user] Error [115] Duplicate label or redefining symbol that cannot be redefined. (_$_000021)

2009-04-07 Thread Raphael Neider
Hi Néstor, >>> # sdcc -mpic14 -p16f877 --nooverlay >>> -I/usr/local/share/sdcc/include/pic/ -I/usr/local/share/sdcc/include/ >>> -c temete1.c >>> temete1.c:62: warning 85: in function PaintClockTest unreferenced >>> function argument : 'x' >>> temete1.c:62: warning 85: in function PaintClockTest u

Re: [Sdcc-user] pic14: floating point error

2009-04-09 Thread Raphael Neider
Hi, > I am trying the sdcc 2.9.0 for the PIC16F876A device. I have found > that the floating point operations are not working well when negative > numbers are used. The PIC14 port was missing a routine implementing unary minus on floats ... and the floating point libraries were broken (fsadd,

Re: [Sdcc-user] sdcc: gen.c:3128: genCmp: Assertion `left->aop->size == right->aop->size' failed.

2009-04-10 Thread Raphael Neider
Dear Nestor, I'm continuously running into trouble with my application since I'm using interrupts. The error that Raphael is trying (I hope) to debug is still there, although it dissappears apparently randomly when changing some code. BTW, I have corrected the error where I have misused 'extern'

Re: [Sdcc-user] PIC14 - Optimizing data use

2009-04-15 Thread Raphael Neider
Hi Antonio, > Is there any switch to pass to compiler to use udata_ovr to some > variable, or to join rx1000... registers in routines that are > not called one by another? > > If I edit many functions in the same file will the compiler reduce > register quantity? The first idea (assigning var

Re: [Sdcc-user] I am getting nowhere :(

2009-05-03 Thread Raphael Neider
Hi, > I have the same problem here. This problem shows with the most > recent preprocessor update fron April 28, 2009. Try installing a > previous version of SDCC. Borut, this would mean that we must keep the April 27th-snapshot available on the web. Can you (with moderate effort) arrange fo

Re: [Sdcc-user] I am getting nowhere :(

2009-05-03 Thread Raphael Neider
Dear Borut, >> I suppose that the problem was introduced in revision 5439 with >> "src/pic16/gen.c (genNearPointerGet): fix double indirect access to >> bitfields (#2782405)", so I can probably remove build 5432. Please >> confirm if I can remove it. > > I meant to remove revision 5436, not 5432..

Re: [Sdcc-user] I am getting nowhere :(

2009-05-03 Thread Raphael Neider
Hi Tim, > The test.c work for me; under Windows XP 64 Bit, > using recent snapshot of SDCC. This is interesting: Which snapshot precisely are you using? r5444 and r5445 produce empty preprocessor output, causing sdcc to output at 1: warning 190: ISO C forbids an empty source file No other error

Re: [Sdcc-user] Problem with interrupts.

2009-05-10 Thread Raphael Neider
Dear Néstor, > I'm running into trouble (once more) when executing my app. I attach > the code so you can see. Your code is too complex to effectively debug it without the hardware, so I can just contribute some ideas: You modify totaltime[] both within Intr() and outside it without protecti

Re: [Sdcc-user] Problem with interrupts.

2009-05-11 Thread Raphael Neider
Dear Néstor, > your answer is very appreciated. I have refactored the code as you > told, I put all the global variables in a header file, called > "defs.h". I have also taken out all the calls to functions from the > interrupt. Now, interrupt handler routine is a lot simpler. Just one > thing: I

Re: [Sdcc-user] Problem with interrupts.

2009-05-12 Thread Raphael Neider
Hi, > One sidenote. IIRC you cannot access the stack on the pic16f devices. > This is only possible on pic18f devices. There is a wonderfull appnote > about that on microhcip website. You are right, but ... I was talking about the pseudo stack that is used by the compiler to pass arguments to s

Re: [Sdcc-user] Linker Problem

2009-05-31 Thread Raphael Neider
Hi Marcelo, > I`m trying to compile the pic16F916 but it has a strange problem when it > calls the linker. > > 1) with this compilation command, without specifying the lkr file, it > calls the default linker: > > C:\>sdcc -mpic16 --out-fmt-ihx test.c > message: using default linker script "C:\Pr

Re: [Sdcc-user] Linker Problem

2009-05-31 Thread Raphael Neider
> However the linker still can`t find the script. I have also tried to call > gplink alone with the -s argument and it doens`t find the file: > > C:\>gplink -m -s 16f916.lkr > 16f916.lkr: No such file or directory > > The default linker script path C:\Program Files\gputils\lkr and i`m sure > the

Re: [Sdcc-user] ADC pic12f675

2009-06-09 Thread Raphael Neider
Dear Vittore, you want to setup the ADC before you start, like: ADCON0 = 0x00; ANSEL = 0x01; in main(). > main() > { ADCON0 = 0x00; /* new */ ANSEL = 0x01; /* new */ > TRISIO=0b0001;                    //pin 0 input - pin 1-4 output > a=10; > b=20; > c=200; > for(;;) >  { >  valore=read_a

Re: [Sdcc-user] Linker error: "Invalid symbol type = for FRPAGE"

2009-09-03 Thread Raphael Neider
Hi Miles, > PS: Not sure if it's related, but I compiled my code with sdcpp, instead > of sdcc. I can't figure out how to give an -MD option to sdcc so that it > passes it on to sdcpp, so I just called sdcpp directly (even though I've > often found it to be problematic to call g++ directly, inste

Re: [Sdcc-user] PIC16 port - how to create array of more than 256 bytes ?

2009-09-04 Thread Raphael Neider
Hi Vaclav, > Have anybody tried with success to create a byte array bigger than 256 > bytes ? I need it for SD/MMC communication and for LAN packets as well. > I have a lot of space in 2kB of SRAM (I use PIC18F2550). But sdcc does > not allow me to declare bigger buffer. In my experience, i

Re: [Sdcc-user] "This is probably a compiler bug..." message

2009-10-17 Thread Raphael Neider
Hi Michel, > I'm now getting a more worrying thing : After I defined a (possibly > incorrect due to my limited C experience...) table of structs, when > compiling I get this one : > > sdcc -mpic14 -p16f886 -V --debug -I/myDir/ -c myProg.c > > encountered NULL pcop--this is probably a compiler bu

Re: [Sdcc-user] The damned loop from hell

2009-11-04 Thread Raphael Neider
Hi Michel, > I fell on a problem on which I just spent a day and a half, plus a whole > night, with no clue :-( > > At this step, as every poor programmer would, I think "this is probably a > compiler issue, otherwise my brain is dead", so it's quite ashamed that I > submit this here... Do not be

Re: [Sdcc-user] pic16f877a function call destroys pointer

2009-11-05 Thread Raphael Neider
Hi, > Program displays just T[glyph/rand char][glyph/rand char][glyph/rand > char] [glyph/rand char]. > > Why is this happening and how can I prevent it? Thanks. You perform pointer arithmetics on generic pointers (*(s+1)), and thus triggered a compiler bug which assigned only the lower 2 byte

Re: [Sdcc-user] Interrupts on a PIC18 - what can I do ...

2009-11-12 Thread Raphael Neider
Hi, >> it would make life easier if I can use multiple interrupts - however >> inside an interrupt routine I need to be able to call other functions >> and do some floating point math. I also need the main interrupt to be >> reentrant, so the longish bit of code that is doing the FP calculations

Re: [Sdcc-user] Another compiler function oddity... ?

2009-11-13 Thread Raphael Neider
Hi, >void delay (uint32_t delay) >{ > setCounter (delay) ; > while (!counterTriggered ()) >; >} > > Gives the error: > >dross.c:435: error 98: conflict with previous definition of 'delay' > for attribute 'type' >from type 'unsigned-long-int' >to type 'vo

Re: [Sdcc-user] PIC16 port - interrupt function prototypes - not working?

2009-11-13 Thread Raphael Neider
Hi, > extern SIGHANDLER(rtcHandler) ; > > DEF_INTHIGH (high_int) > DEF_HANDLER (SIG_TMR1, rtcHandler) > END_DEF > > and in a separate file: > > SIGHANDLER (rtcHandler) > { > ...etc > } > > it compiles fine, but the assembler doesn't like it: > > interrupts.asm:883:E

Re: [Sdcc-user] Another compiler glitch: Is 'data' a pre-defined keyword?

2009-11-16 Thread Raphael Neider
Hi, > This (contrived example) fails to compile: > >void test (int data) >{ > int i ; > i = data ; >} > > Compile command: > >sdcc -mpic16 -p18f4685 -c test.c > > Gives: > >test.c:5: syntax error: token -> 'data' ; column 10 >test.c:6: error 159: in function test

Re: [Sdcc-user] Interrupts on a PIC18 - what can I do ...

2009-11-24 Thread Raphael Neider
> Specifically during compiler generated calls to _mullong although I > haven't tried any others yet. A quick look at the generated .asm shows that sdcc replaces the local union-type variables x, y, t, t1, and t2 with global variables -- which are of course corrupted during the second (nested) exe

Re: [Sdcc-user] asctime for pic18 (or other) ?

2010-01-11 Thread Raphael Neider
Hi, > the same command line in a console does not work either. This may not be > related to mplab-sdcc. That's right, asctime (and most other time/date related functions) are not implemented in SDCC's libc. The "correct" way to use them is to add them to your project and/or contribute them to sdc

Re: [Sdcc-user] asctime for pic18 (or other) ?

2010-01-11 Thread Raphael Neider
Hi, > I *will* code the time functions and contribute them, because I need > them: > -asctime > -difftime > -probably also time_t / struct tm conversions > > How should I proceed? Write the in the lib/src/pic16 directory, then > update the makefiles? (then send a patch, ok) Yepp, that would b

Re: [Sdcc-user] mpic14: overflow in pointer into array calculation.

2010-03-17 Thread Raphael Neider
Hi, SDCC (not restricted to the pic ports) seems to be buggy with array indices; the problem is visible in the iCode as well. struct s { int a; int b; char c; } arr[5]; char demo1(unsigned idx) { return arr[idx].c; } char demo2(unsigned idx) { return arr[idx - 32].c; } char demo3(unsigned ch

Re: [Sdcc-user] mpic14: overflow in pointer into array calculation.

2010-03-18 Thread Raphael Neider
Hi Maarten, > Can you please verify this also with a larger array? IIRC sdcc checks the > array size (in bytes) and then decides if it can get away with 8 bit > calculations. You are right -- sdcc does check the array length: demo{1,5,7} work for arr[255], demo{2,3,4,6} fail (my first posting wa

Re: [Sdcc-user] #define concat function ##

2010-03-20 Thread Raphael Neider
Hi, > On building the above code I get the error message > Undefined identifier 'TRISSSPSTAT_bits' You want to add #define NO_BIT_DEFINES 1 before including pic16f874.h -- otherwise D expands to SSPSTAT_bits.D. Alternatively, you can add -DNO_BIT_DEFINES=1 to the sdcc command line. Best regar

Re: [Sdcc-user] #define concat function ##

2010-03-20 Thread Raphael Neider
Hi, > Ah, I was thinking a bit, hmm very dangerous, before sending this of... > my little section of code does not like this NO_BIT_DEFINES, but what to > do when other sections, the ones borrowed from somebody else, do like it? In that case, you put your code into one (or more) .c files and make

Re: [Sdcc-user] #define concat function ##

2010-03-20 Thread Raphael Neider
Hi Frans, > Ok, did the splitting in two .c files, solved my previous bit addressing > stuff. > Build the lot, got one .lst and .hex file with both my main and the > functions from the other .c > But the main is empty, i.e there is no CALL > > What did I left out? done wrong, forgot to do..

Re: [Sdcc-user] Missing some glue

2010-03-22 Thread Raphael Neider
Hi, > I manged to get a two .c file project compiling ang linked, upon reading > the bin/release .lst file I see this > 02 2803 goto0x3 goto > __sdcc_gsinit_startup > > but no routine with the name. __sdcc_gsinit_startup This is perfectly normal -- library routin

Re: [Sdcc-user] Missing some glue

2010-03-22 Thread Raphael Neider
> 0 errors, 0 warnings > > There are a lot of -I in the +gplink, do I have to investigate this or... These paths are generated by sdcc and (after ../ resolution) refer to the same directory. You need to include only the "actual" path to the .lib files. > Could you comment on the t

Re: [Sdcc-user] about warning 180(promotion to int)

2010-03-28 Thread Raphael Neider
Hi, > warning 180: using ~ on bit/bool/unsigned char variables > can give unexpected results due to promotion to int > > The corresponding codes are: > == >54 void motor_switch_ori() > - 55 { > | 56 mori = ~mori; > | 57 } > ===

Re: [Sdcc-user] mpic14: problem with crossing 4kB code boundary.

2010-03-29 Thread Raphael Neider
Hi, > gpasm: Message [306] Crossing page boundary -- ensure page bits are set. > gplink: no target memory available for section "code_project" I take it you compile for pic14 (or pic16?) devices. You should split your project into multiple (2 or more) source files and link them together. If I rec

Re: [Sdcc-user] Trouble with PIC16 defined asm

2010-04-08 Thread Raphael Neider
Hi, > Compiles to assembler as: > ; ; ***genInline 6286 > MOVFF WREG, PREINC1 MOVFF STATUS, PREINC1 MOVFF INTCON, WREG IORLW > 0x80 MOVFF WREG, PREINC1 > > How do you create newlines in a defined bit of asm You don't: Just use multiple __asm ... __endasm; clauses, as in #define WHATEVER

Re: [Sdcc-user] Why union in bit defs for eg PIC18F4550

2010-05-16 Thread Raphael Neider
Hi, > typedef union { > struct { > unsigned URSTIE : 1; > unsigned UERRIE : 1; > unsigned ACTVIE : 1; > unsigned TRNIE : 1; > unsigned IDLEIE : 1; > unsigned STALLIE

Re: [Sdcc-user] interrupts in pic18

2010-07-20 Thread Raphael Neider
Hi, C is a bit lax with types -- if there is none given, it often assumes int, as in ''extern portb_isr'', which is (correctly) interpreted as ''extern int portb_isr;''. >> For a SIGHANDLER that is defined in the SAME file, I have to forward >> declare it using: SIGHANDLER(portb_isr); ; extern po

Re: [Sdcc-user] error: linker script has no definition that matches the type of section ".idata"

2010-10-06 Thread Raphael Neider
Hi Jonathan, > message: using default linker script > "/usr/local/share/gputils/lkr/18f2431.lkr" > warning: relocation of section ".idata" failed, relocating to a shared > memory location > error: linker script has no definition that matches the type of section > ".idata" Well, actually the

Re: [Sdcc-user] SDCC 3.0.0 Release Candidate 1

2010-10-14 Thread Raphael Neider
Hi, >+++ > make[5]: Entering directory > `/home/claude/work/software/pc/sdcc/sdcc-src-3.0.0-r > c1/device/lib/pic' > gputils not found -- PIC14 library not built! > make[5]: Leaving directory > `/home/claude/work/software/pc/sdcc/sdcc-src-3.0.0-rc > 1/device/lib/pic' > cp:

Re: [Sdcc-user] SDCC 3.0.0 Release Candidate 1

2010-10-14 Thread Raphael Neider
Hi, Shouldn't ./configure check for gputils? Configure did check for gputils, but did not error out if they were not available due to a bug of mine (in pic16/configure.ac; the pic-port would never have errored out but continued to fail on build). I attach a patch (0003-build-system.patch

Re: [Sdcc-user] Putting values in EEPROM on PIC18F

2010-10-15 Thread Raphael Neider
Hi, >> __code unsigned char __at( 0xf0 ) >> values[] = { >> 0x00, 0x01, >> 0x02, 0x03, >> 0x04, 0x05, >> }; >> >> Unfortunately, when I use the EEPROM read commands for index 0, I get >> 0x00, for index 1, I get 0x02, and index 2, I get 0x04. Could you check whether/which of th

Re: [Sdcc-user] Fast Build For 3.0.0 Snapshot of 2010-10-16

2010-10-16 Thread Raphael Neider
Hi, > That is, this file (it was tar.bz2 before I bunzipped it.) --> > sdcc-src-20101016-6030.tar > > I was expecting this to need about 2 hours to build like the 3.0.0-RC1 > src did, but to my amazement the build completed in about 5 minutes. Did you configure with --disable-pic16-port? The pic1

Re: [Sdcc-user] Void Pointer Arithmetic Warnings

2010-10-16 Thread Raphael Neider
> I did unsubscribe from this mailing but I'm still getting mail from you > for some reason... > Could you please make sure I receive no mail from you in the future Please try either/both of these (extracted from the mail): List-Unsubscribe:

Re: [Sdcc-user] SDCC Z80 port. "crt0.rel" and "z80" library missing.

2010-11-06 Thread Raphael Neider
> +++ > checking for rmdir... rmdir > configure: error: gputils (gpasm, gplink, and gplib) are required but > not found. > Either install gputils or reconfigure with --disable-pic14-port and > --disable-pi > c16-port. > configure: error: ./configure failed fo

Re: [Sdcc-user] C-Preprocessor breaks assembly code

2011-02-15 Thread Raphael Neider
Hi, > My question is, is there anyway to tell the C pre-processor to not > replace GO in the assembly section of the code? Or is there some kind of > escape sequence I can use to keep the GO as is? For guys like you I introduced #define NO_BIT_DEFINES 1 #include "pic16f690.h" or sdcc -DNO_BIT_

Re: [Sdcc-user] GPL+LE/LP pic/pic16 header Interest?

2011-03-30 Thread Raphael Neider
Hi, > I am curious if there is any interest in GPL+LE/LP pic/pic16 headers? Well, yes! I just want to inform you that, IIRC, Microchip recently offered half a year or maybe a year ago (I believe after Borut asked them?) to somehow publish their device descriptions in some kind of XML databas

Re: [Sdcc-user] Question: script that generates support for new PIC Microcontrollers

2011-05-16 Thread Raphael Neider
nd would duplicate a lot of code to also support the basic devices. I fear that the situation is similar with the pic14 backend. Kind regards Raphael -- Karlsruher Institut für Technologie (KIT) Institut für Betriebs- und Dialogsysteme Raphael Neider Akademischer Mitarbeiter Am Fasanengarten 5

Re: [Sdcc-user] PIC: joining asm and sdcc

2011-05-25 Thread Raphael Neider
> But I need to access a variable, defined in asm like this: > GLOBAL disp_digits > > UDATA > disp_digits res 5 > > > What would be the correct way to define that variable in C? > I tried this: > extern unsigned char disp_digits[5]; > main(){ > disp_digits[0]="0"; > di

Re: [Sdcc-user] SDCC + Ubuntu 11.04 & MPLAB X

2011-08-19 Thread Raphael Neider
Hi, [...] > /usr/local/bin/sdcc --debug-ralloc --pstack-model=large --pno-banksel > --extended --obanksel=2 -L /usr/share/sdcc/lib/pic16 -L > /usr/share/sdcc/lib/small -I/usr/share/sdcc/include > -I/usr/share/sdcc/include/pic16/ -c -mpic16 -p18f4550 main.c > -obuild/default/production/ma

Re: [Sdcc-user] SDCC + Ubuntu 11.04 & MPLAB X

2011-08-19 Thread Raphael Neider
Hi, > Does not -L /usr/share/sdcc/lib/pic16 tells compiler where to get > libraries, inclusive the libc18f.lib. Yes, but does the file exist? We recently changed the location of the installed pic14/pic16 libraries and headers due to licence issues. That's why I wrote "updated path to sdcc's pic

Re: [Sdcc-user] SDCC + Ubuntu 11.04 & MPLAB X

2011-08-20 Thread Raphael Neider
Hi, > Got the right path: /usr/local/share/sdcc and this folder has other > three: include, lib and non-free. I notice that libc18f is not in > /usr/local/share/sdcc/non-free/lib/pic16 but in but in > /usr/local/share/sdcc/lib/pic16 folder. OK, now you need tell gplink to (i) look there and

Re: [Sdcc-user] An 8051 printf question

2011-09-23 Thread Raphael Neider
Hi, > > >main.c:107: sprintf (str,"%x", (uint8) *sys_rstack); > > >01B4 A9 10 708 mov r1,_sys_rstack > > >01B6 87 07 709 mov ar7,@r1 > > >01B8 C0 07 710 pushar7 [...] > what difference does the cast

Re: [Sdcc-user] PIC18f2455 error: multiple sections using address 0x300000

2011-10-19 Thread Raphael Neider
Hi, > sudo sdcc  -mpic16 -I /usr/local/share/sdcc/non-free/include/ -L > /usr/local/share/sdcc/non-free/lib/pic16  --use-non-free test1.c Using "sudo" here is not necessary and even dangerous: sdcc could decide to overwrite important files ... Additionally (and more towards your problem), you are

  1   2   3   4   >