GP32 Mr.mirkos Sdk Replacement


Ranting Nord posted on Mar 5 2004 at 06:20 PM said:
I'm new to the whole "programming" thing beyond what they teach in school. Does it matter what C/C++ compiler you use? I have access to a linux compiler thru school, but I don't know what kind. The only reason I'm asking is because it looks like this package was made for newbs like me so I figured I'd dabble.
Ranting Nord,

If you use Linux, just download the compiler&SDK from Mirko's homepage.

Because I have no experience of Linux, I'm using ADS under M$-windows.

Enjoy GP!

- omega5 -
 
Last edited by a moderator:
my full mr.mirko'sdk (a mix a of .6, .61 and .62 + nanjungho mods)
mr.mirko sdk
oh and i didnt like the old nanjungho's crt0.s so i take a look at ADS doc, here is a mix of the both crt0.s and it seems to be working
Code:
; Startup code for ADS 1.2 by nanjungho
; User must set link option -first crt0.o(init)
;////////////////////////////////////////////////////////////////////////////@
;// crt0.S                                                                  /@
;////////////////////////////////////////////////////////////////////////////@
  AREA init, CODE, READONLY
  
    	EXPORT __user_initial_stackheap
    	IMPORT |Image$$RO$$Base|; Base of ROM code
  IMPORT |Image$$RO$$Limit|; End of ROM code (=start of ROM data)
  IMPORT |Image$$RW$$Base|; Base of RAM to initialize
  IMPORT |Image$$RW$$Limit|; End of ROM code (=start of ROM data)
  IMPORT |Image$$ZI$$Base|; Base and limit of area
  IMPORT |Image$$ZI$$Limit|; to zero initialize
  EXPORT __main
  IMPORT __rt_entry
; HEADER
  
  ENTRY
  B  __main	
  DCD  |Image$$RO$$Base|; ?
  DCD  |Image$$RO$$Limit|; End of ROM code (=start of ROM data)
  DCD  |Image$$RW$$Base|; Base of RAM to initialize           
  DCD  |Image$$RW$$Limit|; ?                                   
  DCD  |Image$$ZI$$Base|; Base and limit of area              
_HEAPSTART  
  DCD  |Image$$ZI$$Limit|;
_STACKSTART
  DCD  0x0C77FF00  ; same as geepee32(emulator)

__user_initial_stackheap
  LDR   r0,_HEAPSTART
  LDR   r1,_STACKSTART
; r2 not used (HL)                ; The heap limit and stack limit are not used
; r3 not used (SL)                ; in a one-region model
  MOV   pc,lr

__main
        mrs             r0, CPSR
        orr             r0, r0, #0xC0
        msr             CPSR_c, r0

        mrs             r0, CPSR
        bic             r0, r0, #0xC0
        orr             r0, r0, #0x40
        msr             CPSR_c, r0

        B           __rt_entry ; note use B not BL, because an application will never return this way

        END

btw nanjungho, what does the begining of __main???
 
Loki,

I found a difference from your code in gp_timer.c of common library.

My code(=Mirko's code)
(*(volatile unsigned char *)rTICINT) = 0x81;

Your code
rTICINT = 0x81;

Now, RTC is working well just after power-up.
Thank you so much.
I think this problem could be found on GCC also.



For the crt0.s, we need more discussion.
Basically, crt0.s should perform below things.
- copy RW stuff from RO to RW area.
- fill zero on ZI area
- initialize STACK zone
- initialzie HEAP zone
- jump to MAIN

I think STACK pointer is going down from 0x0C77FF00 to ZI-top address.
HEAP pointer is going up from ZI-top address to 0x0C77FF00.

malloc function seems to be working well.
But, I'm not sure whether "__rt_lib_init" / "__rt_entry" can control/initialize each pointer well or not.

Can we have a function like a "free_heap_memory_available()" ?
I want to check HEAP pointer status after several times of malloc()/free().

I believe
if we have stable start-up code, we can have robust SDK.

- omega5 -
 
Code:
__main
       mrs             r0, CPSR
       orr             r0, r0, #0xC0
       msr             CPSR_c, r0

       mrs             r0, CPSR
       bic             r0, r0, #0xC0
       orr             r0, r0, #0x40
       msr             CPSR_c, r0

btw nanjungho, what does the begining of __main???

that was clear up old interrupts.
see um_s3c2400x_rev10 Figure 2-6. Program Status Register Format.

It seems not really necessary.

- nanjungho
 
omega5 posted on Mar 7 2004 at 12:54 AM said:
My code(=Mirko's code)
(*(volatile unsigned char *)rTICINT) = 0x81;

Your code
rTICINT = 0x81;

Now, RTC is working well just after power-up.
Thank you so much.
I think this problem could be found on GCC also.
Probably a define problem in some .h file.. Some register definition .h files distributed by Samsung had errors e.g. conserning RTC registers..
 
Last edited by a moderator:
mr.spiv posted on Mar 8 2004 at 12:07 PM said:
omega5 posted on Mar 7 2004 at 12:54 AM said:
My code(=Mirko's code)
(*(volatile unsigned char *)rTICINT) = 0x81;

Your code
rTICINT = 0x81;

Now, RTC is working well just after power-up.
Thank you so much.
I think this problem could be found on GCC also.
Probably a define problem in some .h file.. Some register definition .h files distributed by Samsung had errors e.g. conserning RTC registers..
It is not a header file define problem.

It seems to be a casting related problem.

rTICINT is a 32bit register.
Does make an endian problem???

I don't know where/what is spcific error.
 
Last edited by a moderator:
loki666 posted on Mar 8 2004 at 12:50 PM said:
is it possible to use the RTC date/calendar function???
with  BCDSEC,BCDMIN etc...
Yes, you can read/write those registers.

But, the values of date/calender/clock are currupted or cleard
when you turn off&on GP32 due to absence of back-up battery.

So, it may not applicable.

If you have a wall-cube external power(3V-DC) and power on forever,
there is no issue.... ^^

- omega5 -
 
Last edited by a moderator:
Because I have no experience of Linux, I'm using ADS under M$-windows.

Like I said, I'm new to the programming thing. What is ADS in M$-windows? I tried google, but all it finds is advertisments.
 
omega5 posted on Mar 8 2004 at 01:15 PM said:
mr.spiv posted on Mar 8 2004 at 12:07 PM said:
omega5 posted on Mar 7 2004 at 12:54 AM said:
My code(=Mirko's code)
  (*(volatile unsigned char *)rTICINT) = 0x81;

Your code
  rTICINT = 0x81;

Now, RTC is working well just after power-up.
Thank you so much.
I think this problem could be found on GCC also.
Probably a define problem in some .h file.. Some register definition .h files distributed by Samsung had errors e.g. conserning RTC registers..
It is not a header file define problem.

It seems to be a casting related problem.

rTICINT is a 32bit register.
Does make an endian problem???

I don't know where/what is spcific error.
Yeh.. casting.. sowwy I mixed it with some other register. Anyways
"All RTC registers have to be accessed by byte unit using STRB and LDRB instructions or char type pointer" - says the manual.
 
Last edited by a moderator:
ok here is what i'm tring to do...
printf
its a early stdio retargeting... (would allow to use fopen(), fread(), fwrite(),... with the smfs lib)
printf family functons seems working (stdout and stderr are emulated with real files in gp:\) but fopen() isn't wokring (the gp32 reboot at start)
it'a bit technical but i know u guys could help me...(refer to the ADS Online Books)
take a look it could be very usefull (and complementary to mr.mirko'sdk)
here is the last mr.mirko'sdk build for ads sdk

maybe its a clib init stuff dont know (the crt0.S dont zero ZI region...)

loki
 
Last edited by a moderator:
Hi loki666,

your work looks very nice, but iam still wondering why you want c-lib
file io functions ??? Until we got no real OS on the gp32, it makes no
different, if we use function a or b to read/write to smc card.
Also keep it mind, that the hole SMC dir is not so "nice" as it looks like.
It must bee replaced in the future ( copyright ). So spending to mutch work in
porting the "lib-c" functions to the smc libs, is a little "waste of time".
What we need, is a new smc lib, smc access, fat reading/writing/formating.

Iam now learing arm9 asembler to write some nice sprite libs ( rotating/stretching/moving/... ) (help wanted....)

soo, good night....

:p
 
Hi Mr.Mirko,

I'm making WMA music player now with your library and Spiv's valuable information.
But, huge calculation of WMA decoding makes a skipping noise. :(

I have a question for sound library to increase the speed.


As you know, there are two PCM buffers as below in sound library.
======================================
#define playbuffer_size 4096*4
static unsigned char playbuffer1[playbuffer_size];
static unsigned char playbuffer2[playbuffer_size];
======================================

Those two bufferes are transfered to IIS FIFO via DMA in rotation(in turns).

I think when the playbuffer1 is doing DMA, we can update the playbuffer2 contents.
otherwise, we can update the playbuffer1 while playbuffer2 is transferring.


But, if you see below code in you library source code,
as you commented, to update a playbuffer, we need to wait for another buffer's
DMA transfer completion.
======================================
void gp_playbuffer( unsigned char *samples,int size) {

int i;
unsigned char *buffer;

if (size > playbuffer_size ) size = playbuffer_size;
while((rDSTAT2)!=0){ }; // wait for dma end...
buffer=playbuffer_zeiger;
for (i=0;i<size;i++) buffer = samples;
}
======================================

If my understanding is correct, the efficiency of the ring-buffer is very low.
Is there any way to improve this routine ?


If I'm wrong, please let me know. :blink:

- omega5 -
 
No, you are not wrong... The sound lib is polling, until the DMA ends.


Create a ringbuffer, working with pointers...
So lets say we have a ring of 64 sound pointers, and the
sound IRQ only switches the "now playing buffer"

Basic work is in the soundmixer dir, but not completet.
So the User sends only his pointer of his sampleram to the mixer,
and the mixer returns emediatly. The mixer puts the pointer in a cue,
and plays it in a ring.

Sorry, but until Monday next week i got no time, 2 college tests... :huh:
 
Okay, thank you.

I'll code the music file selector and more UI stuff by end of this week.

good luck to you for the exams :rolleyes:

- omega5 -
 
omega5 posted on Mar 9 2004 at 02:01 AM said:
Okay at thank you.

I'll code the music file selector and more UI stuff by end of this week.

good luck to you for the exams :rolleyes:

- omega5 -
There's a simple example of DMA based ring buffer in my site.. It could be pretty much close to Mirko's stuff as we exchanges codes earlier considering this area <_< Check it anyway http://www.cs.helsinki.fi/u/jikorhon/condev/gp32/dl/pcm.tgz

And to play safe.. you should make sure your sound buffers have no writeback cache enabled.
 
Last edited by a moderator:
mr.spiv posted on Mar 9 2004 at 08:03 AM said:
omega5 posted on Mar 9 2004 at 02:01 AM said:
Okay at thank you.

I'll code the music file selector and more UI stuff by end of this week.

good luck to you for the exams :rolleyes:

- omega5 -
There's a simple example of DMA based ring buffer in my site.. It could be pretty much close to Mirko's stuff as we exchanges codes earlier considering this area <_< Check it anyway http://www.cs.helsinki.fi/u/jikorhon/condev/gp32/dl/pcm.tgz

And to play safe.. you should make sure your sound buffers have no writeback cache enabled.
Spiv,

First of all, thank you for your code.
I'll be studying your code more carefully.

BTW, I have few questions.

1. Why fs is varing by result of IIS clock calculation?
What makes the selection between 256fs & 384fs ?

2. How I can turn off the writeback cache for specific position?

I saw some document in your homepage.
I think the purpose of swi_mmu_change() function seems to be ....

My sound buffers are located on normal memory and it is a simple global array value.
I don't know how I can locate the buffer on 4K aligned form.

If the default state of writeback cache is disabled by bios, I don't care.
But, I think read-cache and writeback cache both are enabled.

I can't find the swi_mmu_change() function call in your ring-buffer example.


Please kindly let me know.
 
Last edited by a moderator:
omega5 posted on Mar 9 2004 at 09:12 AM said:
omega5 posted on Mar 9 2004 at 26:01 YM said:
1. Why fs is varing by result of IIS clock calculation?
What makes the selection between 256fs & 384fs ?

You get better output freq estimates depending on the fs selection. Sometimes 256 is better than 384 and wise versa. There are some notes and tables on these in the Samsung manual.

omega5 posted on Mar 9 2004 at 26:01 YM said:
2. How I can turn off the writeback cache for specific position?

I saw some document in your homepage.
I think the purpose of swi_mmu_change() function seems to be ....

Yes.. this swi_mmu_change()..

omega5 posted on Mar 9 2004 at 26:01 YM said:
My sound buffers are located on normal memory and it is a simple global array value.
I don't know how I can locate the buffer on 4K aligned form.

For exampe:

char buffer[BUFFERSIZE+4095];
char *ptr = (buffer + 4095) & ~4095;

Now ptr is 4K aligned.

And by default all "user RAM" has both read cache & writeback enabled.

omega5 posted on Mar 9 2004 at 26:01 YM said:
I can't find the swi_mmu_change() function call in your ring-buffer example.

Yep.. shame on me. But there was a note that "Note! This sample data buffer _should_ be in non-writeback cached
memory!!!
" As the example does not really do mixing during playing so that wasn't necessary - lazyness you know.
Hope this helped.
 
Last edited by a moderator:
Back
Top