CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

#org >64K

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Ian McCrum



Joined: 26 Oct 2003
Posts: 14
Location: Northern Ireland

View user's profile Send private message Visit poster's website

#org >64K
PostPosted: Fri May 14, 2004 7:05 am     Reply with quote

Hi, I am currently working with a 18C801, this has no internal ROM and allows up to 2MBytes of external memory. Curent wirewrap board has 128k of flash and 128k of RAM.

I want to download executable code into the RAM, which starts at 0x20000 and then provide the user with a 'G' command to start executing it
(just the liike the good old days of mikbug and beyond...)

I have the bootloader/monitor code written and mainly working, just about ('G' is tricky...)
I need to generate code that starts at 128k and not 0x0000

I belive the statements below should do this, but they don't ( I dissassembled the code)

#build (RESET=0x20000)
#org 0x20000,0x2FFFF default

// syntax above is approximate, I am away from my own Pc at present)

The #org's produce assembler with the address clipped to the bottom 64k.
How do I set the #ORG to a value >64k ?
TIA
Ian
_________________
Ian McCrum, email address held at
www.eej.ulst.ac.uk/~ian
jaremek16
Guest







PostPosted: Fri May 14, 2004 7:42 am     Reply with quote

At first address of #build must be out of range #ORG, try:

Code:
#build (RESET=0x20000)
#org 0x2001A,0x2FFFF {}


Second send me your file *.sta, maybe I will be able to help you.
Of course project must be compiled first.

Best regards
Jarek Gawin Smile
[email protected]
Ian McCrum



Joined: 26 Oct 2003
Posts: 14
Location: Northern Ireland

View user's profile Send private message Visit poster's website

PostPosted: Fri May 14, 2004 3:12 pm     Reply with quote

Thanks Jarek, I have also emailed you, your advice above works great, provided the addresses are less than 64k, here is code that breaks

___

// Bug/Feature in #ORG ... it is restricted to 64K
// Compiled with Version 3.120 (PCH)
// But the 18C801 can have 2 MByte of program space
// Ian McCrum , University of Ulster

#include <18C801.h>
#use delay(clock=20000000)
#use rs232(baud=2400, xmit=PIN_C6,rcv=PIN_C7)

// If you swop the two lines below by adding trailing ZEROs
// you get an error : Internal Error -Contact CCS => Code 65.0.11
//
#build (RESET=0x2000)
#org 0x2002,0x20FF DEFAULT
//#build (RESET=0x20000)
//#org 0x20020,0x20FF0 DEFAULT
void main() {
while(TRUE){
putc('+');
}//---- end while ----
}//---- end main ----

__
the working code assembles to 30 words of program and looks great, the internal error is a bit of a nusiance. Must read up to see if I can post process the intel hex file to relocate code... <sigh>
_________________
Ian McCrum, email address held at
www.eej.ulst.ac.uk/~ian
jaremek16
Guest







PostPosted: Mon May 17, 2004 2:22 am     Reply with quote

Hi Ian
I had also this problem but I solved it by reserve rest of lower memory.
(sorry for my english if you didn't understand me, I still learn)
Try this:

Code:
#include <18C801.h>
#use delay(clock=20000000)
#use rs232(baud=2400, xmit=PIN_C6,rcv=PIN_C7)

#org 0x0001A,0x0FFFF {}   // leave this memory free
#org 0x10000,0x1FFFF {}   // leave this memory free
#build (RESET=0x2000)

void main() {
while(TRUE){
putc('+');
}//---- end while ----
}//---- end main ----

__


It works on compiler 3.185
I hope that it helps you.
If you can't do it directly try to do it in other way.

By the way you can also meet other problem, how to change size of memory because standard size for compiler is only 64kB.
If you have PCW see at "tools/device editor" and choose PIC18C801, than change memory ROM from 48576 to 131072 otherwise I don't know how to solve this problem with standalone PCH compiler.

I have experiences with PIC18C601 but it is similar to 801.

I chacked my example of programme:

Code:
#include <18C601.h>
#NOLIST
#build(reset=0x20000)
#org 0x0001A,0x0FFFF {}  // Reserve space for the user program
#org 0x10000,0x1FFFF {}  // Reserve space for the user program

#use delay(clock=20000000)
#fuses NOWDT,WDT128,HS, PUT, BW8, STVREN
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7)  // ,bits=8

void main()
{
   ........
}


And as the result I can see in file prog.sta following information:
Code:
Page ROM  %  RAM  Functions:
---- --- --- ---  ----------
2    372  49   0  main

 Segment   Used  Free
---------  ----  ----
00000-00018     0  26
0001A-0FFFE     0  65510
10000-1FFFE     0  65536
20000-20002     4  0
20004-2FFFE   372  65160
30000-3FFFE     0  65536


Best regards
Ian McCrum



Joined: 26 Oct 2003
Posts: 14
Location: Northern Ireland

View user's profile Send private message Visit poster's website

#ORGs >64k
PostPosted: Mon May 17, 2004 2:49 am     Reply with quote

Many many thanks for your reply, Jarek.

I have pasted your code into my compiler and I still get a CCS internal error 65:0:11, even after altering the memory size in the device editor.

I use PCH version 3.120 and note in the CCS website that it has bugs that were fixed...

// Note: http://www.ccsinfo.com/versions.shtml ... list of bugs
//
// 3.140 Some internal limits increased to permit very large programs
// 3.165 Some bugs with programs > 128K are now fixed
// 3.177 A problem with #org's over 0x20000 is fixed <<<<<
// 3.179 Better support for parts with external memory has been added
// 3.188 New separate bootloader examples have been added
// 3.189 Some #org issues have been addressed <<<<<<<

I have emailed CCS, maybe they will help a poor University that has bought a compiler that was sold "not fit for the purpose it was bought for"
8-(
<sigh>

The quickest fix is for me to upgrade.

Thanks again for your time.
Kindest Regards
Ian

__ Smile
_________________
Ian McCrum, email address held at
www.eej.ulst.ac.uk/~ian
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group