6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Mon Sep 30, 2024 10:44 pm

All times are UTC




Post new topic Reply to topic  [ 87 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6  Next
Author Message
 Post subject: Re: Beginners cc65
PostPosted: Fri Jun 15, 2012 6:20 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10940
Location: England
Any bad aspect of the first scenario?


Top
 Profile  
Reply with quote  
 Post subject: Re: Beginners cc65
PostPosted: Fri Jun 15, 2012 6:22 pm 
Offline
User avatar

Joined: Mon Aug 08, 2011 2:48 pm
Posts: 808
Location: Croatia
The first scenario when everything is in ram, it all works perfectly...


Top
 Profile  
Reply with quote  
 Post subject: Re: Beginners cc65
PostPosted: Fri Jun 15, 2012 6:27 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10940
Location: England
Sounds good to me! If it's also what you see for other platforms, there may be a reason.


Top
 Profile  
Reply with quote  
 Post subject: Re: Beginners cc65
PostPosted: Fri Jun 15, 2012 6:44 pm 
Offline
User avatar

Joined: Mon Aug 08, 2011 2:48 pm
Posts: 808
Location: Croatia
I tried to move the ram to the rom range, and it works...
But still everything is in ram.


Top
 Profile  
Reply with quote  
 Post subject: Re: Beginners cc65
PostPosted: Fri Jun 15, 2012 6:50 pm 
Offline
User avatar

Joined: Mon Aug 08, 2011 2:48 pm
Posts: 808
Location: Croatia
I found the source of the problem. It is the DATA segment.

In this scenario it works.
Code:
MEMORY {
   HEADER:  start = $C000, size = $0004, type = ro;
   ZP:      start = $0000, size = $00D0, type = rw, define = yes;
   RAM:     start = $0200, size = $1E00, file = %O, define = yes;
   ROM:     start = $C200, size = $3CFF, file = %O, define = yes;
}
SEGMENTS {
   EXEHDR:   load = HEADER,          type = ro;
   STARTUP:  load = ROM, type = ro;
   LOWCODE:  load = ROM, type = ro,               optional = yes;
   INIT:     load = ROM, type = ro, define = yes, optional = yes;
   CODE:     load = ROM, type = ro;
   RODATA:   load = ROM, type = ro;
   DATA:     load = ROM, type = rw;
   BSS:      load = RAM, type = bss, define = yes;
   HEAP:     load = RAM, type = bss, optional = yes; # must sit just below stack
   ZEROPAGE: load = ZP,  type = zp;
}


But when i send the DATA segment in ram, it sets the jmp instructions to 0000
Code:
MEMORY {
   HEADER:  start = $C000, size = $0004, type = ro;
   ZP:      start = $0000, size = $00D0, type = rw, define = yes;
   RAM:     start = $0200, size = $1E00, file = %O, define = yes;
   ROM:     start = $C200, size = $3CFF, file = %O, define = yes;
}
SEGMENTS {
   EXEHDR:   load = HEADER,          type = ro;
   STARTUP:  load = ROM, type = ro;
   LOWCODE:  load = ROM, type = ro,               optional = yes;
   INIT:     load = ROM, type = ro, define = yes, optional = yes;
   CODE:     load = ROM, type = ro;
   RODATA:   load = ROM, type = ro;
   DATA:     load = RAM, type = rw;
   BSS:      load = RAM, type = bss, define = yes;
   HEAP:     load = RAM, type = bss, optional = yes; # must sit just below stack
   ZEROPAGE: load = ZP,  type = zp;
}


Top
 Profile  
Reply with quote  
 Post subject: Re: Beginners cc65
PostPosted: Fri Jun 22, 2012 6:40 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8521
Location: Southern California
I just found, by accident, that Wikipedia has an article on cc65, and http://en.wikipedia.org/wiki/Cc65 .

Edit, 2/14/21: I just came across this page about benchmarking the various C compilers for the 6502. CC65 produced much slower, more bloated code than the other C options, although it was more solid.

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
 Post subject: Re: Beginners cc65
PostPosted: Sat Jul 28, 2012 4:07 am 
Offline
User avatar

Joined: Mon Aug 08, 2011 2:48 pm
Posts: 808
Location: Croatia
I've finally found the documentation what i was looking for. Here it is, and it explains how to boot the code from rom.
http://www.cc65.org/doc/customizing-2.html


Top
 Profile  
Reply with quote  
 Post subject: Re: Beginners cc65
PostPosted: Sat Jul 28, 2012 6:48 am 
Offline

Joined: Tue Jul 24, 2012 2:27 am
Posts: 674
Dajgoro wrote:
Where are the document that describe the configuration files, i can't find them...


The reference for the config files is actually under the ld65 section: http://www.cc65.org/doc/ld65-5.html

_________________
WFDis Interactive 6502 Disassembler
AcheronVM: A Reconfigurable 16-bit Virtual CPU for the 6502 Microprocessor


Top
 Profile  
Reply with quote  
 Post subject: Re: Beginners cc65
PostPosted: Sat Sep 29, 2012 9:00 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10940
Location: England
You might find some help at http://www.fririki.net/6502/cc65_sbc.html


Top
 Profile  
Reply with quote  
 Post subject: Re: Beginners cc65
PostPosted: Sun Sep 30, 2012 2:59 pm 
Offline
User avatar

Joined: Mon Aug 08, 2011 2:48 pm
Posts: 808
Location: Croatia
Thanks for the link.


Top
 Profile  
Reply with quote  
 Post subject: Re: Beginners cc65
PostPosted: Sun Sep 30, 2012 9:48 pm 
Offline
User avatar

Joined: Mon Aug 08, 2011 2:48 pm
Posts: 808
Location: Croatia
I tried setting up the cc65 with the sim.cfg from the link, and when i tried to load it in the simulator it won't work. So i checked the disassembled code and the first thing on the address C000 is a loop that writes something to zero page. I tried setting up the start vector, but the simulator doesn't check it, and it just starts executing at the point where i loaded the binary code.


Top
 Profile  
Reply with quote  
 Post subject: Re: Beginners cc65
PostPosted: Wed Nov 21, 2012 7:00 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 9:02 pm
Posts: 1738
Location: Sacramento, CA
Hey Dajgoro,

Did you ever get the ROM code to work the way you wanted?

I spent some time with cc65 tonight and think I have a better handle on it now. Will experiment more tomorrow to confirm but I am getting code to load to ROM with the crt0.s code at the starting address. I still need to be sure the DATA segment is being copied to RAM correctly. I should have a working demo ready soon.

Daryl

_________________
Please visit my website -> https://sbc.rictor.org/


Top
 Profile  
Reply with quote  
 Post subject: Re: Beginners cc65
PostPosted: Wed Nov 21, 2012 6:11 pm 
Offline
User avatar

Joined: Mon Aug 08, 2011 2:48 pm
Posts: 808
Location: Croatia
I tried to get it working when i discovered that links, and how to make it boot from rom. But whatever i tried it never worked, and when i would step it in the simulator it seems as if it would never set the reset vector right, so i never managed to boot anything.
If you manage to get it working in the Kowalski simulator like that last example, i would be really grateful.
Also i was thinking since my new cpu board will have the mmu, i could kinda switch programs on the fly, and add sorta of os that would allow to boot other programs into ram. Also i could implement Petit FAT so i can read/write from memory cards as well.


Top
 Profile  
Reply with quote  
 Post subject: Re: Beginners cc65
PostPosted: Wed Nov 21, 2012 8:22 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 9:02 pm
Posts: 1738
Location: Sacramento, CA
I did get the "hello1" demo file to load into ROM and run successfully. I think I have the vectors (IRQ,RST,NMI) working too. I end up with a 32768 byte image when I tell it to start at $8000. A smaller ROM would be easy to adjust for.

I need to test it a little more and then will try to document the steps so others can repeat them. Hope to have something ready by the weekend.

My goal is to connect an ENC28J60 Ethernet module to the AVR Emulator and try to serve up a simple web page. I want to include the 8 channel ADC data in web page along with some digital I/O points. That would make a cool remote monitoring system.

Daryl

_________________
Please visit my website -> https://sbc.rictor.org/


Top
 Profile  
Reply with quote  
 Post subject: Re: Beginners cc65
PostPosted: Wed Nov 21, 2012 9:53 pm 
Offline
User avatar

Joined: Mon Aug 08, 2011 2:48 pm
Posts: 808
Location: Croatia
Great!

As for spi ethernet module, any good tutorials on how set up and communicate with it(or how to deal with multiple sessions if they exist).


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 87 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


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 post attachments in this forum

Search for:
Jump to:  
cron