6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sun Nov 24, 2024 7:58 am

All times are UTC




Post new topic Reply to topic  [ 32 posts ]  Go to page 1, 2, 3  Next
Author Message
PostPosted: Thu May 11, 2023 12:46 pm 
Offline

Joined: Wed Jan 08, 2014 3:31 pm
Posts: 578
I haven't seen this covered in another thread. Below is a project that puts a 6502 into the Arduino form factor.

https://hackaday.com/2023/05/10/hackada ... r-package/

Something similar was done with the 1802 a few years ago. So it should be possible to port some of the project below to the 6502.

https://olduino.wordpress.com/about-2/about/


Top
 Profile  
Reply with quote  
PostPosted: Fri May 12, 2023 9:48 am 
Offline
User avatar

Joined: Fri Aug 03, 2018 8:52 am
Posts: 746
Location: Germany
Oooh, I like the idea of this. Especially if you can still use the arduino IDE with it.
But I'd like it more if it used modern and still active parts...
The 65c02 and 65c22 are available in more compact packages like PLCC or even *QFP if space is really tight.
Now I kinda want to see if I can throw together a mockup of such an arduino like board using modern parts (and of course without PWM or analog IO)...
Maybe later when I got some time.


Top
 Profile  
Reply with quote  
PostPosted: Fri May 12, 2023 11:18 am 
Offline

Joined: Fri Dec 21, 2018 1:05 am
Posts: 1120
Location: Albuquerque NM USA
Proxy wrote:
Oooh, I like the idea of this. Especially if you can still use the arduino IDE with it.


I thought Arduino IDE (the software interface) is specific to AVR microprocessor family? I'm interested to hear your idea. I found Arduino Mega enclosure have more space and have built several SBC for Arduino Mega enclosure but none of them is based on 65xx. I'm interested to try again but with 65xx this time.
Bill


Top
 Profile  
Reply with quote  
PostPosted: Fri May 12, 2023 11:33 am 
Offline
User avatar

Joined: Wed Feb 14, 2018 2:33 pm
Posts: 1488
Location: Scotland
plasmo wrote:
Proxy wrote:
Oooh, I like the idea of this. Especially if you can still use the arduino IDE with it.


I thought Arduino IDE (the software interface) is specific to AVR microprocessor family? I'm interested to hear your idea. I found Arduino Mega enclosure have more space and have built several SBC for Arduino Mega enclosure but none of them is based on 65xx. I'm interested to try again but with 65xx this time.
Bill


You can back-end the Arduino IDE with different compilers, downloaders, etc. It's been used to target ARM and RISC-V for example.

And while I've not looked at this in detail, there's no reason why it can't be done here - you need a small bootloader ROM that takes a big binary blob over serial and run it.

The "blob" needs to be pretty much everything. Your own code, the serial handler, GPIO handlers/libraries, everything as one big binary. So nothing in ROM you can use - no "monitor" or OS in ROM, nothing for your own code to call - just the bare minimum to initialise the serial port and take a file in whatever format is used.

So 256 bytes of ROM then almost the full 64K for RAM minus a little for IO and off you go. Of-course microcontrollers would typically download into Flash to preserve the code at power-off - but again, I'd need to look closer at this project to see what it does, but there's no reason such a system couldn't be developed for the 6502 if needed.

Personally I think the Arduino IDE is an abomination but that's because I've been using an editor + makefiles for decades, however millions of people like it, use it and are very familiar with it. It's all written in Java so very cross platform friendly - I've run it under Linux but it works under Mac and MS Window too.

It's actually a very very easy way to program microcontrollers (in C/C++/Other supported compiler) which is why it's so popular and why the ATmega took-off in the hobby world all those years back.

I do find it interesting they're using the 6507 CPU to reduce chip size. It might ultimately be a limitation on code and ram size though... But as a proof of concept for an SMT system it's pretty neat.

-Gordon

_________________
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/


Top
 Profile  
Reply with quote  
PostPosted: Fri May 12, 2023 1:49 pm 
Offline

Joined: Fri Dec 21, 2018 1:05 am
Posts: 1120
Location: Albuquerque NM USA
Hmm, interesting; a 6502 SBC that is simple, no ROM, no mass storage, but a very high speed serial interface to Arduino IDE. It can bootstrap from the IDE, load applications, and get data file from IDE via high speed serial connection. I think I have a hardware for it. https://www.retrobrewcomputers.org/doku ... og65r2home
Bill


Top
 Profile  
Reply with quote  
PostPosted: Fri May 12, 2023 2:43 pm 
Offline
User avatar

Joined: Wed Feb 14, 2018 2:33 pm
Posts: 1488
Location: Scotland
plasmo wrote:
Hmm, interesting; a 6502 SBC that is simple, no ROM, no mass storage, but a very high speed serial interface to Arduino IDE. It can bootstrap from the IDE, load applications, and get data file from IDE via high speed serial connection. I think I have a hardware for it. https://www.retrobrewcomputers.org/doku ... og65r2home
Bill


All you have to do is write the software, then port all the Arduino libraries then ...

Make sure pin 13 blinks the LED :-)

-Gordon

_________________
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/


Top
 Profile  
Reply with quote  
PostPosted: Fri May 12, 2023 3:21 pm 
Offline
User avatar

Joined: Sat Dec 01, 2018 1:53 pm
Posts: 730
Location: Tokyo, Japan
drogon wrote:
So 256 bytes of ROM then almost the full 64K for RAM minus a little for IO and off you go. Of-course microcontrollers would typically download into Flash to preserve the code at power-off - but again, I'd need to look closer at this project to see what it does....

I had only a quick look at it, but unless I'm missing something it's just a 6507, RIOT and 27C512 EEPROM. So the code is going into flash, unless I'm totally missing something here.

But the only RAM is from the RIOT, so all of 128 bytes there. From a note on the schematic, the RIOT's address map is $00-$7F for RAM and $80-$FF for I/O. A12 high selects EEPROM and A12 low selects the RIOT, so you have the RAM+I/O mirrored through the bottom 4K, flash EEPROM in the next 4K, and this pattern is repeated to the end of the address space.

So far, all good; we have a nice little base for an embedded system.

But now he talks about programming it in C. With 128 bytes of RAM shared between the stack and the heap, but at different addresses depending on whether you want to use it as zero page or stack. This sounds pretty dubious to me, but maybe he's smarter than I am, has written an appropriate little crt0.o to start the stack pointer at $17F, put the heap in the zero page, and has somehow told cc65 that $00-$7F and $100-$17F are the same area of RAM and it needs to take extreme care not to let the stack go down far enough to start stomping on the heap.

But then I look again at the schematic and there's no /WE signal on the EEPROM. Oh, right; the 27C512 needs an extra address pin, so JEDEC (or maybe Winbond) replaced Vpp with A15 and /WE with A14 and it's now programmed by bringing /OE up to 12 V and a pulse on /CE. But wait, on the schematic /CE is tied to ground, /OE is on a 74HC04 output, and there's not a trace of 12V to be seen anywhere anyway. This EEPROM can't be programmed in-system.

Yeah, I think his design got as far as, "can I fit it on a board this size and shape?" and he immediatey built that without taking the design any further.

And, while the 6502 is a fine little processor for its time, and even now if you're ok at writing assembler, it doesn't seem terribly fit for the Arduino ecosystem and its mass of bloated C++ libraries, where "blink a single LED" can be a 4K program. So what we have is:
  • A CPU not well suited for C
  • running at at least 1/8th, more likely 1/16th, the clock speed of an AVR
  • that uses far more cycles than an AVR to do the same thing,
  • has binaries rather larger than an AVR, and
  • has a small fraction of the memory (both RAM and EEPROM) of most AVRs.

So what's the point? Building an embedded system that uses the least resources possible is certainly a standard thing to do for reasonaby competent engineers, but not for the kind of learners that Arduino is aimed at. Arduino (correctly for its audience) aims at ease of doing simple things for beginners at the cost of bloat, but that's not the 6502 world.

Someone mentioned that the 6502 is a simpler processor than the AVR (56 instructions vs. 131, etc.), which is true to some extent, but you never see that from C except occasionally in very painful ways, so I don't see any point there.

There's a good case to be made that a 6502 system can be a good way to learn low-level programming, but that's something that just doesn't mix with the Arduino world except in the most superficial ways.

This doesn't seem to be well thought through, and I would never have given it a prize. But I guess just slapping "6502" on something really, really pleases some people.


Attachments:
File comment: Schematic for 65uino.
65uino-sch-bw.png
65uino-sch-bw.png [ 92.75 KiB | Viewed 2662 times ]

_________________
Curt J. Sampson - github.com/0cjs
Top
 Profile  
Reply with quote  
PostPosted: Fri May 12, 2023 3:26 pm 
Offline
User avatar

Joined: Fri Aug 03, 2018 8:52 am
Posts: 746
Location: Germany
drogon wrote:
The "blob" needs to be pretty much everything. Your own code, the serial handler, GPIO handlers/libraries, everything as one big binary. So nothing in ROM you can use - no "monitor" or OS in ROM, nothing for your own code to call - just the bare minimum to initialise the serial port and take a file in whatever format is used.

really? i would use ROM space specifically to have libraries and such already included, so the actual binary being loaded can be much smaller.

drogon wrote:
Of-course microcontrollers would typically download into Flash to preserve the code at power-off

that's one thing i would do with this as well. which also means that you need a larger ROM to fit a whole program into it.
for example 32k of RAM and 32k of Flash, with the choice in the IDE to either compile a program to be loaded into RAM (to just run it) or to Flash (to be able to boot directly into it).
this would also make it more arduino-like as you get the ability to use the board without a PC to bootload it.

though one alternative could be to have a small ROM with most of the address space being RAM, but then include an onboard SPI Flash chip that contains the bootloader and/or uploaded user code.
advantage is that you now don't have a ROM taking up a fixed amount of address space, so a smaller programs leaves more RAM for data.
but the disadvantage is that you need an extra IC, and use up 4 IO lines to access the SPI Flash. (though you might be able to use 3 of those IO lines after booting. as long as ~SS is pulled high, MISO, MOSI, and SCK should stay in tri-state. meaning they could be used as GPIO).

drogon wrote:
Personally I think the Arduino IDE is an abomination but that's because I've been using an editor + makefiles for decades, however millions of people like it, use it and are very familiar with it. It's all written in Java so very cross platform friendly - I've run it under Linux but it works under Mac and MS Window too.

the new one is pretty good (though the options menu didn't get much better). i'm usually also very minimalistic with my programming setups, but it is genuinely nice to use.


Top
 Profile  
Reply with quote  
PostPosted: Fri May 12, 2023 3:28 pm 
Offline
User avatar

Joined: Wed Feb 14, 2018 2:33 pm
Posts: 1488
Location: Scotland
cjs wrote:
And, while the 6502 is a fine little processor for its time, and even now if you're ok at writing assembler, it doesn't seem terribly fit for the Arduino ecosystem and its mass of bloated C++ libraries, where "blink a single LED" can be a 4K program. So what we have is:
  • A CPU not well suited for C
  • running at at least 1/8th, more likely 1/16th, the clock speed of an AVR
  • that uses far more cycles than an AVR to do the same thing,
  • has binaries rather larger than an AVR, and
  • has a small fraction of the memory (both RAM and EEPROM) of most AVRs.

So what's the point?


To look cool, boost your "presence" and get a million click-throughs to your youtube channel to get more £££ ...

-Gordon

_________________
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/


Top
 Profile  
Reply with quote  
PostPosted: Fri May 12, 2023 3:35 pm 
Offline
User avatar

Joined: Fri Aug 03, 2018 8:52 am
Posts: 746
Location: Germany
i mean you could ask "what's the point" for basically any project on here. there is pretty much no practical reason to ever use a 65xx CPU for anything if you have modern MCUs that cost almost nothing in comparison and are way more powerful with better toolchains.

most of the time the point is just: "why not?" or "because it seems like a fun challange/project".
in this case it's the latter reason, just a fun challange to come up with a design that would work


Top
 Profile  
Reply with quote  
PostPosted: Fri May 12, 2023 3:38 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10986
Location: England
I'd say the designer is quite clear that this is Arduino form-factor - that's not the same as fully Arduino.

So, the EEPROM holds a boot loader, and by some means you do your programming elsewhere and upload your binary. There's a hint that the designer intends to elaborate on this and perhaps provide something slick.

And your I/Os, presumably, appear on appropriate pins on the appropriate connectors, like an Arduino.

(For all that Arduino has probably helped a lot in electronics teaching and learning, it's potentially confusing that the word has many meanings - it's a trademark, it's a form factor, it's a runtime library, it's an IDE, it's a convention for how code gets loaded, it's a particular implementation of an SBC in that form factor. Perhaps more. It's a brand.)


Top
 Profile  
Reply with quote  
PostPosted: Fri May 12, 2023 3:40 pm 
Offline
User avatar

Joined: Wed Feb 14, 2018 2:33 pm
Posts: 1488
Location: Scotland
Proxy wrote:
drogon wrote:
The "blob" needs to be pretty much everything. Your own code, the serial handler, GPIO handlers/libraries, everything as one big binary. So nothing in ROM you can use - no "monitor" or OS in ROM, nothing for your own code to call - just the bare minimum to initialise the serial port and take a file in whatever format is used.

really? i would use ROM space specifically to have libraries and such already included, so the actual binary being loaded can be much smaller.


Sure - but that's not really how "arduino" works. Your libraries are on the local filing system, linked in at compile time - which in-theory results in the smallest footprint possible. You'd have to tailor the cc65 (or whatever C you use) and the crt0.s to understand that too and provide stubs to each ROM libary call.... Might as well just compile it into one big binary and send it over...

Of-course, no-one in their right mind will use this for real but it's an interesting test/demo of what might have been/be possible. The w65c134 might be a better suited thing to start with for this sort of thing though. Hm. I have one here -

-Gordon

_________________
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/


Top
 Profile  
Reply with quote  
PostPosted: Fri May 12, 2023 3:45 pm 
Offline
User avatar

Joined: Sat Dec 01, 2018 1:53 pm
Posts: 730
Location: Tokyo, Japan
Proxy wrote:
i mean you could ask "what's the point" for basically any project on here. there is pretty much no practical reason to ever use a 65xx CPU for anything if you have modern MCUs that cost almost nothing in comparison and are way more powerful with better toolchains.

I disagree. Programming a 6502 is fun and a great learning experience. As is building a 6502 board with a CPU and a bunch of peripherals.

But while a go-kart is a good first step if you're wanting eventually to drive a Formula 1 race car, it's not a good first step if you want to learn to pilot a cargo ship. Just because they both transport things from A to B doesn't mean that learning one is going to give you useful techniques for the other. Even if you do modify the go-kart to float.

_________________
Curt J. Sampson - github.com/0cjs


Top
 Profile  
Reply with quote  
PostPosted: Fri May 12, 2023 3:55 pm 
Offline
User avatar

Joined: Sat Dec 01, 2018 1:53 pm
Posts: 730
Location: Tokyo, Japan
BigEd wrote:
I'd say the designer is quite clear that this is Arduino form-factor - that's not the same as fully Arduino.

True. And there might be a case to be made that a 6502 SBC in an original Arduino form factor could be handy in some way, such as being able to use the certain Arduino "shields."

But generally, when people speak of Arduino, they are not speaking of, much less focusing on, that form factor. There are tons of "Arduinos" out there that are not in that form factor (probably more than there are in the original form factor—I certainly see far more projects using a Nano than the original). What really distinguishes "Arduino" from other SBCs is the way it's programmed and the libraries that are typically used. (And I'm not dissing that; putting together that kind of development environment is great for the purpose for which it's intended.)

Quote:
So, the EEPROM holds a boot loader, and by some means you do your programming elsewhere and upload your binary.
To where? If you're thinking of putting your code, as well as your data and stack, into RAM, you're not going to get very far at all. Remember, the design has no support at all for in-system programming of the EEPROM, whereas in-system EEPROM programming is pretty much a sine qua non of Arduino. It's one of the things that made it so much more successful than the many similar systems available at the same time.

_________________
Curt J. Sampson - github.com/0cjs


Top
 Profile  
Reply with quote  
PostPosted: Fri May 12, 2023 4:12 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10986
Location: England
Hmm, yes, good point, barely any RAM...


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 64 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: