32 MBytes and Speed of Execution

Amadeus amadeus at iksw-muees.de
Fri Sep 1 14:42:46 CEST 2006


yesterday, I have made some tests and measurements regarding the 
performance of applications. I have tried to implement stereo MP3 in 

Madplay is in romfs and XIP, so all code is located in main memory, and 
data+bss+stack are allocated in RAM by the binfmt loader, and there is 
a streaming buffer of 40-64K for reading of MP3 files from SD. The SD 
driver is using bankswitching to access the SD card.

First, I have eliminated SD card reading by reading the whole MP3 file 
at the start of the song in memory. This makes no big difference. The 
conclusion is that reading from SD is fast enough for MP3 streaming. I 
think the code in scsd_x.x is near optimum and need not be optimized 

Second, I have changed the ARM9 DMA into an ARM7 DMA buffer in WRAM, and 
filling from main memory with an ARM7 interrupt function. Again, this 
makes no big difference. The sound problems are most of the time not 
related to a blocked main memory arbiter.

Third, I have switched the stack of the inner ARM assembler code in 
libmad to use the DTCM memory. There is a difference, but not much.

There is a visible difference, if madplay is started again and again. I 
think the big problem here is access to the data and stack section, and 
it's because the data cache is only 4 KByte small, and there is more 
data in libmad. Cache aligment seems to play a role here.

So the fact is, that a data streaming application like madplay suffers 
most from using the GBA ROM space as data+bss+stack. It's about 50% of 
the speed of an application running completely in main memory.

So, to get stereo MP3 quality, we will have to allocate data+stack in 
main memory. Don't know how to do today, we will have to modify the 
binfmt loader.

In the meantime, I have made a modification to the ARM7 sound driver to 
play mono streams as stereo, getting the same sound amplitude as 
playing stereo (playing only one channel gives only half of the output 

We're back to the times when men were men 
and wrote their own device drivers.

(Linus Torvalds)

More information about the dslinux-devel mailing list