Hi George,

thanks for the tip. However I want to see how far I can go with C. Looking
at my interrupt code there are not that many obvious places where hand
coding would improve things a lot so overall from the maintainability
point of view I first want see if I could do this in C. Having grown
up on 8 bit CPUs (1802,8080,6800,6502,8085,Z80,HC11,HC08, oops this
reveals how old I am ;-) I feel I've done my bit of assembly language
programming. But if it may come to that in the end.

Right now I would just want to get rid of those extra register push/pops,
after discoving '--pno-banksel' option to get rid of all BANKSEL
instructions the compiled code looks actually rather nice to my not
so well trained PIC eye.
  

br Kusti


> From: "George M. Gallant" <ggallant...@comcast.net>
> Reply-To: <sdcc-user@lists.sourceforge.net>
> Date: Mon, 9 Mar 2009 15:46:22 +0200
> To: <sdcc-user@lists.sourceforge.net>
> Conversation: [Sdcc-user] PIC port, __naked not working, Bus error, signal 11:
> SIGSEGV
> Subject: Re: [Sdcc-user] PIC port, __naked not working, Bus error, signal 11:
> SIGSEGV
> 
> Kustaa,
> 
> I gave up on using SDCC for interrupts and process UART interrupts in
> assembler.
> I setup 2 queues, one for transmit and one for extraction. Each queue
> has an insert
> pointer, extraction pointer, and byte count. With this scheme I am able
> to reliably
> communicate with a host PC at 38400 on a 40MHz PIC18F2620.
> 
> If you allocate 256 bytes for each queue the wrap is handled by the PIC.
> It does
> require some code to manage the transmit interrupt state.
> 
> George
> 
> Kustaa Nyholm wrote:
>> Hi list,
>> 
>> 
>> in order to  get rid of some longish preamble in my interrupt I tried to
>> define the interrupt as '__naked' but this produced 'Bus error' during
>> compilation.
>> 
>> After a lot of pruning I got the code down to:
>> 
>> unsigned char x;
>> 
>> void test()  __naked  {
>>         if (x) {
>>                 x = 1;
>>             }
>>     }
>> 
>> which when compiled with parameters:
>> 
>> SDCCFLAGS = "-Wl,-m,-s 18f4550.lkr" -mpic16 -p18f4550 --disable-warning 85
>> --std-sdcc99 --obanksel=3 --pno-banksel
>> 
>> 
>> produces SIGSEGV .
>> 
>> If I remove the __naked the problem disappears, but I'm back in square one.
>> 
>> So this appears to be compiler bug. I tried to look for this in the list
>> archives but I could not find anything related to that.
>> 
>> Now I have specific questions:
>> 
>> 1) Should I file a bug?
>> 
>> 2) How can I circumvent this?
>> 
>> My actual problem is that the compilers emits a lot of code like:
>> 
>> 002C C000 FFE5 01503         MOVFF   r0x00, POSTDEC1
>> 0030 C000 FFE5 01504         MOVFF   r0x01, POSTDEC1
>> 0034 C000 FFE5 01505         MOVFF   r0x02, POSTDEC1
>> 0038 C000 FFE5 01506         MOVFF   r0x03, POSTDEC1
>> 003C C000 FFE5 01507         MOVFF   r0x04, POSTDEC1
>> 0040 C000 FFE5 01508         MOVFF   r0x05, POSTDEC1
>> 
>> that I would like to avoid, all I want is for the compiler to allocate
>> these are global variables used solely by the interrupt so that there
>> is no need to save/restore them...I know 'naked' alone would not do this
>> but it seems like a necessary step in getting there...?
>> 
>> 3) I seem to recall some list discussion relating to PIC / inline assembly
>> and that it does not work or something but I cannot find that
>> discussion. Is there a problem there?
>> 
>> br Kusti
>> 
>> 
>> 
>> 
>> 
----------------------------------------------------------------------------->>
-
>> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
>> -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
>> -Strategies to boost innovation and cut costs with open source participation
>> -Receive a $600 discount off the registration fee with the source code: SFAD
>> http://p.sf.net/sfu/XcvMzF8H
>> _______________________________________________
>> Sdcc-user mailing list
>> Sdcc-user@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/sdcc-user
>> 
>>  
> 
> ------------------------------------------------------------------------------
> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
> -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
> -Strategies to boost innovation and cut costs with open source participation
> -Receive a $600 discount off the registration fee with the source code: SFAD
> http://p.sf.net/sfu/XcvMzF8H
> _______________________________________________
> Sdcc-user mailing list
> Sdcc-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sdcc-user


------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to