Rockbox Technical Forums

Rockbox Development => New Ports => Topic started by: krfkeith on March 25, 2012, 12:58:07 AM

Title: Feasibility of Cortex-M4 Port?
Post by: krfkeith on March 25, 2012, 12:58:07 AM
STMicroelectronics has the ridiculously low-priced Discovery dev boards for their STM32F4 MCUs.  The board itself is too limited, but it's easy enough to add anything we would need (namely, more RAM, DAC, display).  I asked on IRC about potential difficulties of such a port, and one person noted that Cortex chips use Thumb-2, which could potentially introduce some pitfalls. I am vaguely aware that Thumb is some sort of subset of the main ARM ISA, but nothing more specific than that. I do have a fairly good knowledge of programming, but I am not particularly versed in ARM (though I am willing to learn what I need to). Could anyone here with more experience shed some light on what, if any, issues might arise in this endeavor?  

EDIT:
Well, it appears as though the STM32 chips don't have a DDR controller, bummber :( .  But! Freescale's Kinetis processors seem to have everything else I would need, and the DRAM controller.
Title: Re: Feasibility of Cortex-M4 Port?
Post by: torne on March 25, 2012, 04:49:50 AM
It shouldn't be too difficult to get a port going on an M4, but you will need to tweak a number of bits of our assembly to make it okay for Thumb2. The majority of assembly is in codecs, though, so you shouldn't have too much trouble in the course of getting it to boot.
Title: Re: Feasibility of Cortex-M4 Port?
Post by: saratoga on March 25, 2012, 05:19:53 PM
I looked through the M4 reference manual and the assembly looks fairly similar to ARMv5E in terms of coverage, although I'm assuming its not actually compatible with it.  For things like codecs it would probably not be too hard to adapt the more important bits for the M4.  Given how power efficient the new cortex chips are supposed to be, it might not be that important anyway.
Title: Re: Feasibility of Cortex-M4 Port?
Post by: torne on March 26, 2012, 05:22:50 AM
Thumb2 is almost entirely compatible with the ARM instruction set; it adds back virtually everything Thumb was missing (at the cost of having a pretty complex decoder). There are some old fashioned things it doesn't do, but those tend to have been deprecated and replaced in ARMv7-A anyway.
Title: Re: Feasibility of Cortex-M4 Port?
Post by: phr on April 10, 2013, 01:21:27 AM
How much memory does an audio player really need, anyway?  The fancier Discovery board has 192k of ram and 1mb of flash, which is probably more than the players of the early Rockbox era had (Archos Jukebox etc).  There is supposedly a newer version of the chip in the works with 512k ram.
Title: Re: Feasibility of Cortex-M4 Port?
Post by: saratoga on April 10, 2013, 08:03:44 AM
2.5 to 4 MB depending on your screen and what features are enabled.
Title: Re: Feasibility of Cortex-M4 Port?
Post by: gevaerts on April 10, 2013, 09:19:25 AM
192k of ram and 1mb of flash, which is probably more than the players of the early Rockbox era had (Archos Jukebox etc).

Those had 2MB RAM
Title: Re: Feasibility of Cortex-M4 Port?
Post by: wodz on April 10, 2013, 02:32:02 PM
Archos Jukebox uses hardware decoder as well while CM4 port will use software decoding which needs substantial amount of ram. IIRC there was afford to port rockbox to 2MB arm target and it was proven difficult.
Title: Re: Feasibility of Cortex-M4 Port?
Post by: c.azrael on October 27, 2014, 01:38:00 AM
i think it would work
the Rockchip RKnano support all  common loseless format with only a 100MHz Cortex-M3 and 128KB IRAM 96KB DRAM
Title: Re: Feasibility of Cortex-M4 Port?
Post by: wodz on October 27, 2014, 06:05:07 AM
Do you have any technical materials about RKnano? Are you sure there is no additional DSP core with its own memory? 128k+96k isn't a lot. From the computational point of view 100MHz Cortex-M3 is more then enough for most formats (actually you can look how good arm7tdmi @ 80MHz performs in all PortalPlayer devices).
Title: Re: Feasibility of Cortex-M4 Port?
Post by: saratoga on October 27, 2014, 07:08:55 AM
100 MHz M3 is quite fast by our standards. With SRAM memory and a faster multiplier than arm7tdmi its probably faster than at least half out devices.

The lack of memory would be a problem though. Flac and mp3 will be fine but forget aac or vorbis. Most of our core features and DSP won't fit either. Realistically if you want a color screen and most features you'll need about 2MB.
Title: Re: Feasibility of Cortex-M4 Port?
Post by: c.azrael on November 28, 2014, 12:50:45 AM
stm32radio run rt-thread RTOS
STM32F103ZE +512k SRAM+2M SPI Flash+wm9878 DAC
http://stm32radio.googlecode.com/svn/trunk/stm32radio
decoding FLAC level0-level8 OK
Program Size: Code=82888 RO-data=6412 RW-data=524 ZI-data=61652 
SRAM filebuffer=16*1024
Title: Re: Feasibility of Cortex-M4 Port?
Post by: wodz on November 28, 2014, 05:01:18 AM
512k of ram is too little for rockbox.
Title: Re: Feasibility of Cortex-M4 Port?
Post by: saratoga on November 28, 2014, 02:03:06 PM
http://stm32radio.googlecode.com/svn/trunk/stm32radio

Quote
Copyright (C) 2007 Michael Giacomelli

:)

But yes, while you can run some of our decoders with so little memory, you won't be able to fit much of an operating system on such a simple device. 
Title: Re: Feasibility of Cortex-M4 Port?
Post by: c.azrael on November 29, 2014, 11:27:07 AM
http://stm32radio.googlecode.com/svn/trunk/stm32radio

Quote
Copyright (C) 2007 Michael Giacomelli

:)

But yes, while you can run some of our decoders with so little memory, you won't be able to fit much of an operating system on such a simple device.
yes :) , only flac decoding, APE decoding on and off even overclocking :(
maybe STM32F4 (or STM32F7?) work properly :)
Title: Re: Feasibility of Cortex-M4 Port?
Post by: braimp on October 27, 2015, 10:38:50 PM
what is the result?did you finish it?
Title: Re: Feasibility of Cortex-M4 Port?
Post by: c.azrael on October 22, 2017, 10:37:40 AM
http://www.st.com/en/evaluation-tools/32f746gdiscovery.html (http://www.st.com/en/evaluation-tools/32f746gdiscovery.html)
(http://f1.hifidiy.net/forum/201512/09/131445nkhd6t6oe27uud06.jpg)
(http://f1.hifidiy.net/forum/201512/09/131353cfqreq5wkf1l85ee.jpg)
A good choice  :)