cancel
Showing results for 
Search instead for 
Did you mean: 

Help me speed up my stm32f7

troy1818
Senior
Posted on July 29, 2016 at 19:49

Hi everyone,

I am making an emulator that is emulating an old c64 computer. For this I am using a custom made hardware. This has a STM32F756 MCU together with 200Mhz SDRAM installed. The real heavy things for this project is the emulation of the VIC chip (graphics). This takes a lot of stm32 cycles where every pixel needs to be computed for 320x200 screen @ 50Hz. I am using LTDC for this where I have simply mapped up a memory area in SDRAM for a frame, and it is to this memory area where all pixels are plotted to. I am using the RGB565 pixel format (do not know if this can effect the speed). I have no clue what kind of load the LTDC stuff is having on MCU.

I am running my application with full optimization and with inline functions etc. from flash (does not seem to be running faster in ram). I am running at 216Mhz and with overdrive active.

Now my problem is that my application is unfortunately running 40% too slow :\

So if any of you got any idea how to get even more out of the stm32f7 I would be grateful :)
5 REPLIES 5
Posted on July 29, 2016 at 21:01

Ambitious goal, a C64 emulator on Cortex-M.  Is it for educational purpose or targeted as a real replacement for the real vintage hardware ?

In lack of knowledge of your software and hardware, here only some general tips / questions :

Caches enabled ? Aware of TCM ? Using DMA/DMA2D ? 16bit colours for an C64 emu is odd. Use LUT 8bit instead to save memory bandwidth  and the DSP if possible to accelerate pixel calcs. But overall, I doubt that a Cortex-M is fast enough to emulate a C64 cycle exact including SID and VIC to run actual demo productions like PC based emulators. How do you emulate and manage the floppies images ? How do you implement the audio out and the joysticks ?

Good luck,

Markus.
Posted on July 29, 2016 at 22:17

In a previous life I had bitcopier hardware reading Commodore GCR disks..

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
troy1818
Senior
Posted on July 29, 2016 at 23:59

Yes, it is very ambitious, luckily I am an ambitious guy :)

I just so love these challenges. Actually I already made an old version of it here: 

https://www.youtube.com/watch?v=uI4o9XAFLt0

If you are interested some information about new version can be found here: 

http://www.staringlizard.com/2015/12/03/memwa-ii/

and it starts to look really good, but as I said. I am afraid that I need to take some extreme shortcuts if I cannot get more performance out of the design.

But you are right, it is not fast enough to emulate whole c64 ''cycle perfect''. But if you exclude SID (which is the most tricky) by using real HW (or replacement) and you instead say ''cycle almost perfect'' then it starts to look much more feasible :D

TCM does not do anything for me. DMA does not help me either since I still need to copy the individual pixels to the frame buffer. I do not know if DMA2D can make things better, as I understand it, this is just for drawing boxes and stuff ? and I just need to draw pixels.

I do not have cache enabled for my SDRAM FSMC, perhaps I should turn this on... ?

I have cortex cache (I and D) enabled though.

Who needs floppy images when you have .tap and .t64 ? :)

But anyway, if you want floppy drive you can just emulate it in the same way you emulate c64 and just turn it on when it is needed. Joysticks are connected to gpio interrupt pins.

Posted on July 30, 2016 at 11:58

Thanks for sharing your designs. I love the hardware platform for memwa2. But you are not sharing the design files and the firmware like in the memwa1 project. Is this because you have some NDA like information inside for the HDMI transmitter ? Also no Youtube video with some code running. I would like to have one board, too. Not for the C64 emulator, there are a lot of hardware and software emulations for the C64 out there who work well (and i still own a working vintage C64). I would like to see how the hardware performs to do some Demoscene like stuff. You are using CooCox and eagle for SW/HW, right ?

Best regards,

Markus.
troy1818
Senior
Posted on July 30, 2016 at 21:02

Hi Markus,

Im glad you liked it.

Yes, the reason for not having any source files and design files is because everything is not ready yet. Hence this thread :)

I think that I will have something ready in a month or two where I will disclose everything.

I am not using any platform for sw development, just plain makefiles. For hw design I am using proteus atm.