Hi Diego,

(Sorry you're receiving this twice.  I meant to reply only to sdcc-user list.)

In this situation, I do need 
for the variables to be at specific address/bank locations.  Like I 
said, think of this as having an existing assembly program where you 
want to convert parts of it to C.

Another
 issue is the sheer number of banksel statements generated by sdcc for a
 large memory model.  I read some mention somewhere about a way to do a 
banksel statement early in the code to avoid that, but I didn't 
understand what I read and haven't seen any examples of how it's done.  
How is this normally managed in C where code space is too precious to 
give away?

I'm sure I'm missing some 
fundamental concept of how to adapt C to a PIC environment; possibly 
related to the way I created my project.  But everything I've tried has 
some big problem that makes it nonviable for my
 project.

Bob



________________________________
 From: Diego Herranz <diegoherr...@diegoherranz.com>
To: Bob Stewart <b...@evoria.net>; sdcc-user <sdcc-user@lists.sourceforge.net> 
Sent: Thursday, June 5, 2014 7:51 AM
Subject: Re: [Sdcc-user] Banking 101 for 18F PICs
 


You can simply use variables (global or local/automatic depending on what you 
need) and SDCC+GPUTILS will place them wherever they consider and instructions 
for switching banks will be generated automatically when accesing/using those 
variables.

So, unless you need variables to be on specific address/bank you don't need to 
care about it.

Regards,
Diego






On Thu, Jun 5, 2014 at 4:53 AM, Bob Stewart <b...@evoria.net> wrote:

I've been developing someone else's assembly code in Piklab for 18F2220 for 
about a year and I'd like to move at least some of it to C as a learning 
experience for another project I want to do.  I have variables in the Access 
Bank, Bank0, and Bank1.  I only access the variables in Bank0 via FSR, so I 
don't have to mess with banking for the rest. I cannot figure out how to 
duplicate this in C on SDCC.  I'm not new to C, just to C with micros.  I'm 
certainly new to banking in a C environment.
>
>As an example, the following (which are defined in CBLOCKs in the assembly 
>code).  How do I define them in sdcc, and access them as described above?  Do 
>I use small or large memory model?  I can't even figure out how to begin.
>
>Access ram:
>   
 TEMP1_H                  ;13_Temporary 16-bit var available throughout code 
execution.
>    TEMP1_L                  ;14_ "
>
>Bank0:
>    TIC_CAL_0                ;00_Address of first value beginning with 0x00
>    TIC_CAL_1                ;01_Address of first value beginning with 0x01
>    TIC_CAL_TABLE:.99 
>
>Bank1:
>    OLD_CCPR1L               ;0_Previous CCPR1L value
>   
 OLD_CCPR1H               ;1_Previous CCPR1H value
>
>
>Bob - AE6RV
>
>------------------------------------------------------------------------------
>Learn Graph Databases - Download FREE O'Reilly Book
>"Graph Databases" is the definitive new guide to graph databases and their
>applications. Written by three acclaimed leaders in the field,
>this first edition is now available. Download your free book today!
>http://p.sf.net/sfu/NeoTech
>_______________________________________________
>Sdcc-user mailing list
>Sdcc-user@lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/sdcc-user
>
>
------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their 
applications. Written by three acclaimed leaders in the field, 
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to