6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sun Nov 24, 2024 5:50 pm

All times are UTC




Post new topic Reply to topic  [ 10 posts ] 

What are your favorite ARM Cortex-M processors?
ARM Cortex-M0 0%  0%  [ 0 ]
ARM Cortex-M0+ 17%  17%  [ 1 ]
ARM Cortex-M1 0%  0%  [ 0 ]
ARM Cortex-M3 17%  17%  [ 1 ]
ARM Cortex-M4 33%  33%  [ 2 ]
ARM Cortex-M7 33%  33%  [ 2 ]
ARM Cortex-M23 0%  0%  [ 0 ]
ARM Cortex-M33 0%  0%  [ 0 ]
Total votes : 6
Author Message
PostPosted: Mon Jan 15, 2018 1:00 am 
Offline

Joined: Fri Jan 12, 2018 5:04 am
Posts: 1
Hi, I've ported Mike Chamber's fake6502 emulator to STMicroelectronics's STM32F103 ARM Cortex-M3 microcontroller, available on minimum ARM development boards commonly known as the "blue pill", sold on Aliexpress and eBay for about $1.69. I call it pill_6502, and it can be downloaded here:

https://github.com/satoshinm/pill_6502

There are other 6502 emulators for ARM microcontrollers I'm aware of: Shane Gough's tgl6502 for the Cortex-M0 LPC810, and Ed Spittles a6502 (and its predecessor stm6502 by Chris Baird) for the Cortex-M4 STM32F4. pill_6502 is somewhere in between these two emulators, targeting the mid-range 72 MHz Cortex-M3 STM32F103. stecdose posted in 2015 about an emulator for this same microcontroller family but I couldn't find if he published it so I decided to make my own. IMHO, this processor ('F103) and board (blue pill) is in a sort of "sweet spot", drastically cheaper than the F4 dev boards, yet more powerful than the lowest-end ARM Cortex-M0 processors.

So far the emulator is very basic, only implementing the 6502 and the minimal functionality of the 6850 ACIA to allow Microsoft BASIC to run. Heavily inspired by Grant Searle's Simple6502, except it has half the memory due to STM32F103 limitations (only 20 KB total RAM in this microcontroller). But it makes up for the less memory by having built-in USB support, and the ACIA serial communications chip is bridged to a USB CDC-ACM device, so it shows up as a USB modem serial port on your modern computer. By my calculations this makes it cheaper than building a hardware 6502 system with the CPU, RAM, ROM, ACIA, and USB-to-serial chips, although perhaps that's not surprising. Everything is fully integrated:

Image

Haven't yet experimented with adding more devices and I/O, but with the number of pins and types of peripherals this board supports, it could be quite promising. I'm not too familiar with the 6502 and homebrew computing so if anyone is interested in taking this project further I posted the source on GitHub. Any feedback/suggestions/pull requests/forks welcome.


Top
 Profile  
Reply with quote  
PostPosted: Mon Jan 15, 2018 9:19 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10986
Location: England
Welcome satoshinm, and nice work! Thanks for publishing it, too.

> the ACIA serial communications chip is bridged to a USB CDC-ACM device, so it shows up as a USB modem serial port on your modern computer

This is a nice built-in feature to have!


Top
 Profile  
Reply with quote  
PostPosted: Fri Jan 19, 2018 2:11 am 
Offline
User avatar

Joined: Wed Feb 13, 2013 1:38 pm
Posts: 590
Location: Michigan, USA
I'd love to try this. I have a couple "blue pill" boards and an ST-LINK v2 that I use with Arduino. Is there a way to get a copy of the binary image and burn it into one of my "blue pill" boards using the STM32 ST-LINK Utility on my Windows 7 system?

TIA. Cheerful regards, Mike


Top
 Profile  
Reply with quote  
PostPosted: Sun Apr 22, 2018 1:42 am 
Offline
User avatar

Joined: Wed Feb 13, 2013 1:38 pm
Posts: 590
Location: Michigan, USA
bump!!!

anyone know how to get and install this onto a "blue pill" board? I haven't figured it out yet from this Gentleman's blog or github pages...

Cheerful regards, Mike


Top
 Profile  
Reply with quote  
PostPosted: Mon Mar 09, 2020 4:56 am 
Offline

Joined: Mon Mar 09, 2020 4:23 am
Posts: 3
Hi guys,

I joined up to actually talk about this and provide a little bit of support. I'm aware that this is quite an old post, but seeing as it sent me on something of a journey i'd like to bring it some closure. One of my friends and I had a bit of a tinker with the github code that was posted by the OP, however after getting the project to build it quickly became apparent that maybe some final lines / modifications weren't committed to the repository?

Anyway, we've both taken something of a different approach to getting a solution; I took the code made by the OP and ported it to run with STMicro's STM32CubeMX libraries, which I managed to get working here:
https://github.com/schmidah/STM32EMU6502
A quick video of it in operation:
https://www.youtube.com/watch?v=Kqgg1iMldgs

My friend was able to modify and get working the original source, from the OP:
https://github.com/9names/pill_6502

To compile the source code in each project you'll need to install an ARM toolchain, such as:
https://developer.arm.com/tools-and-sof ... ain/gnu-rm
As well as some build tools, such as those from cygwin:
https://cygwin.com/install.html

However, if you're not that familiar with the process of building this stuff I've included in my github the compiled output.
https://github.com/schmidah/STM32EMU650 ... 326502.hex

To install this onto a blue pill, you can use an ST-LINK clone or similar JTAG device that supports SWDIO.
I used an ST-LINK clone with STMicro's utility for their ST-LINK programmers:
https://www.st.com/en/development-tools ... nk004.html

Happy to answer any questions, in relation to the above!

Happy emulating!


Top
 Profile  
Reply with quote  
PostPosted: Mon Mar 09, 2020 6:26 am 
Offline
User avatar

Joined: Sun Jun 30, 2013 10:26 pm
Posts: 1951
Location: Sacramento, CA, USA
Mike Chambers' implementation has a BCD bug. I placed a proposed fix for it in the public domain.

viewtopic.php?p=37758#p37758

_________________
Got a kilobyte lying fallow in your 65xx's memory map? Sprinkle some VTL02C on it and see how it grows on you!

Mike B. (about me) (learning how to github)


Top
 Profile  
Reply with quote  
PostPosted: Mon Mar 09, 2020 8:26 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10986
Location: England
Welcome, schmidah, and thanks for sharing your joint explorations!


Top
 Profile  
Reply with quote  
PostPosted: Mon Mar 09, 2020 9:17 am 
Offline

Joined: Mon Mar 09, 2020 4:23 am
Posts: 3
Thanks for the heads up barrym95838.

I've added those fixes into my source code and recommitted to the repository.


Top
 Profile  
Reply with quote  
PostPosted: Mon Mar 09, 2020 9:02 pm 
Offline
User avatar

Joined: Sun Jun 30, 2013 10:26 pm
Posts: 1951
Location: Sacramento, CA, USA
Excellent! It looks like the executable may have grown a little bit, but only by about 100 bytes, right?

_________________
Got a kilobyte lying fallow in your 65xx's memory map? Sprinkle some VTL02C on it and see how it grows on you!

Mike B. (about me) (learning how to github)


Top
 Profile  
Reply with quote  
PostPosted: Mon Mar 09, 2020 9:46 pm 
Offline

Joined: Mon Mar 09, 2020 4:23 am
Posts: 3
Yes, I turned the BCD mode on to ensure it was compiling in correctly.

Previously the #define NES_CPU was disabling it, so i removed the define to ensure the compilation would complete without error.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC


Who is online

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