Mike - K8LH
Well-Known Member
Hi guys,
Just trying to put together a C demo' for someone using the new BoostC (free/lite) version 7.01 compiler (in MPLAB) but getting a strange error and wondering if anyone can help?
I'm trying to declare a 256 byte ROM array but BoostC seems to be trying to put it into RAM...
And here's the Linker error I'm getting;
Just trying to put together a C demo' for someone using the new BoostC (free/lite) version 7.01 compiler (in MPLAB) but getting a strange error and wondering if anyone can help?
I'm trying to declare a 256 byte ROM array but BoostC seems to be trying to put it into RAM...
Code:
/********************************************************************
* *
* Project: CTCSS 12F683 *
* Source: CTCSS_12F683.c *
* Author: Mike McLaren, K8LH *
* Date: 26-Nov-10 *
* Revised: 26-Nov-10 *
* *
* DDS-PWM CTCSS Tone Generator Demo *
* *
* *
* IDE: MPLAB 8.56 (tabs = 4) *
* Lang: SourceBoost BoostC v7.01, Lite/Free version *
* *
********************************************************************/
#include <system.h>
#pragma DATA _CONFIG, _MCLRE_OFF, _WDT_OFF, _HS_OSC
#pragma CLOCK_FREQ 8388608 //
//--< function prototypes >------------------------------------------
//--< type definitions >---------------------------------------------
typedef unsigned char u08;
typedef unsigned int u16;
typedef unsigned long u32;
#define r08 rom unsigned char
//--< variables >----------------------------------------------------
u32 accum = 0; // phase accumulator
u32 phase = 0; // phase offset (DDS tuning word)
r08 sine[] = { 100,102,104,107,109,112,114,117,
119,121,124,126,129,131,133,135,
138,140,142,144,147,149,151,153,
155,157,159,161,163,165,167,168,
170,172,174,175,177,178,180,181,
183,184,185,187,188,189,190,191,
192,193,194,194,195,196,197,197,
198,198,198,199,199,199,199,199,
200,199,199,199,199,199,198,198,
198,197,197,196,195,194,194,193,
192,191,190,189,188,187,185,184,
183,181,180,178,177,175,174,172,
170,168,167,165,163,161,159,157,
155,153,151,149,147,144,142,140,
138,135,133,131,129,126,124,121,
119,117,114,112,109,107,104,102,
99, 97, 95, 92, 90, 87, 85, 82,
80, 78, 75, 73, 70, 68, 66, 64,
61, 59, 57, 55, 52, 50, 48, 46,
44, 42, 40, 38, 36, 34, 32, 31,
29, 27, 25, 24, 22, 21, 19, 18,
16, 15, 14, 12, 11, 10, 9, 8,
7, 6, 5, 5, 4, 3, 2, 2,
1, 1, 1, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 1, 1,
1, 2, 2, 3, 4, 5, 5, 6,
7, 8, 9, 10, 11, 12, 14, 15,
16, 18, 19, 21, 22, 24, 25, 27,
29, 31, 32, 34, 36, 38, 40, 42,
44, 46, 48, 50, 52, 55, 57, 59,
61, 64, 66, 68, 70, 73, 75, 78,
80, 82, 85, 87, 90, 92, 95, 97 };
//--< defines >------------------------------------------------------
//--< main >---------------------------------------------------------
void interrupt() // 200-cycles (10485.76-Hz)
{ pir1.TMR2IF = 0; // clear TMR2 interrupt flag
accum += phase; // add phase offset to accum
ccpr1l = sine[accum>>16]; // sine duty cycle value for
} // next PWM period
void main()
{
cmcon0 = 7; // comparator off, digital I/O
while(1) //
{ //
} //
}
Code:
Error: Memory allocation failed - No remaining memory block (on target) with suitable start address,
big enough for : 'sine' in file: C:\Users\Michael\Documents\PIC Projects\BoostC\CTCSS_12F683.c
size:256 bytes
Last edited: