Jump to content
Sign in to follow this  
FrankGe

Compiler Problem With Arrays

Recommended Posts

Hello

 

BOOSTC 1.9.3

PIC16F877A

OS XP SP2

 

A little project with 3 files

 

main.c

--------

#pragma CLOCK_FREQ 20000000

#include <system.h>

#include "test.h"

 

#pragma DATA 0x2007, _PWRTE_ON & _WDT_OFF & _HS_OSC & _BODEN_ON & _LVP_OFF

 

rom char *msg = "Message";

 

void main( void )

{

 

while(1)

{

write ('a');

write ("Test");

write (msg);

}

 

}

 

 

test.h

-------

#ifndef _test_H_

#define _test_H_

 

void write (const char c);

void write (const char *s);

void write (rom char *s);

 

#endif

 

test.c

-------

#include "test.h"

 

void write (const char c)

{

char a = c;

}

 

void write (const char *s)

{

while (*s)

write (*s++);

}

 

void write (rom char *s)

{

char i = 0;

char c;

while (c = s)

{

write ©;

i++;

}

}

 

 

Compiling...

 

"d:\Program Files\SourceBoost\boostc.pic16.exe" -t PIC16F877A main.c test.c

 

BoostC Optimizing C Compiler Version 1.9.3 Beta (for PIC16 architecture)

http://www.picant.com/c2c/c.html

Copyright© 2004-2005 Pavel Baranov

Copyright© 2004-2005 David Hobday

 

 

test.c(18:13): error: failed to generate expression

failure

Done

Share this post


Link to post
Share on other sites

Of course this code won't compile. Operations on rom variables use a built-in function __rom_get declared in system header and test.c doesn't include system.h

 

Regards,

Pavel

Share this post


Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...