Vaclav Peroutka wrote:
> Hello all (especially Raphael),
>
> 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.
>
> Thank you in advance,
> Vaclav
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now. http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Sdcc-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/sdcc-user
>
I found that using absolute addressing works best for this type of thing ...
I was using #pragmas to force bank selection when trying to limit the
number of bank selects produced and --pno-banksel and had the same
problem with arrays > 256 bytes
also works: If you want to use the access bank ram *and* have the
compiler produce efficient access bank assembler instead of almost every
second instruction being a bank select
Using #pragma statements to specify the variable bank as bank0 will not
do this.
(for example as in #pragma udata bankacc myvariable)
from my code packets.c using a 2 kB array of 128 times 16 bytes
#include <stdint.h>
#include <pic18fregs.h>
#include "../code/global.h"
<snip>
//set aside some chunks for packet storage
//NumberOfChunks=128
CHUNK_t __at (0x0600) Heap[NumberOfChunks];//128*16=2kBytes
//need to track chunk usage (using 1 byte per chunk)
uint8_t __at (0x0080) HeapUsage[NumberOfChunks];//128 Bytes
uint8_t __at (0x07F) startuse = (uint8_t)(&HeapUsage)&0xff;
The makefile invokes the linker like so and specifys the linker script
to use
sdcc -mpic16 -Wl-m -Wl-s"18f4620.lkr" -Wa-C $(RELS) ${addsuffix
",${addprefix -l", $(LIBS)}} -I"D:/sdcc/include/pic16/" -o"myproject.hex"
The linker script: with debugging areas protected .
// File: 18f4620.lkr
// Sample linker script for the PIC18F4620 processor
// Not intended for use with MPLAB C18. For C18 projects,
// use the linker scripts provided with that product.
// "stolen" and modified for myproject
LIBPATH .
CODEPAGE NAME=page START=0x0 END=0xFCFF
// In Circuit Debugging uses these rom
CODEPAGE NAME=icdbmon START=0xFD00 END=0xFFFF
PROTECTED
CODEPAGE NAME=idlocs START=0x200000 END=0x200007
PROTECTED
CODEPAGE NAME=config START=0x300000 END=0x30000D
PROTECTED
CODEPAGE NAME=devid START=0x3FFFFE END=0x3FFFFF
PROTECTED
CODEPAGE NAME=eedata START=0xF00000 END=0xF003FF
PROTECTED
ACCESSBANK NAME=accessram START=0x0 END=0x7F
DATABANK NAME=gpr0 START=0x80 END=0xFF
DATABANK NAME=gpr1 START=0x100 END=0x1FF
DATABANK NAME=gpr2 START=0x200 END=0x2FF
DATABANK NAME=gpr3 START=0x300 END=0x3FF
DATABANK NAME=gpr4 START=0x400 END=0x4FF
DATABANK NAME=gpr5 START=0x500 END=0x5FF
DATABANK NAME=gpr6 START=0x600 END=0x6FF
DATABANK NAME=gpr7 START=0x700 END=0x7FF
DATABANK NAME=gpr8 START=0x800 END=0x8FF
DATABANK NAME=gpr9 START=0x900 END=0x9FF
DATABANK NAME=gpr10 START=0xA00 END=0xAFF
DATABANK NAME=gpr11 START=0xB00 END=0xBFF
DATABANK NAME=gpr12 START=0xC00 END=0xCFF
DATABANK NAME=gpr13 START=0xD00 END=0xDFF
DATABANK NAME=gpr14 START=0xE00 END=0xEF3
// In Circuit Debugging uses these ram
DATABANK NAME=icdbram START=0xEF4 END=0xEFF PROTECTED
//discourage use of last 128 bytes: use BANK gpr15 indirectly if needed
DATABANK NAME=gpr15 START=0xF00 END=0xF7F PROTECTED
//SFR registers
ACCESSBANK NAME=accesssfr START=0xF80 END=0xFFF PROTECTED
hope that is of some use .
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Sdcc-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sdcc-user