Rockbox Development > Starting Development and Compiling

New to Rockbox Development, Plugins?

<< < (5/7) > >>

safetydan:
You might want to look at the helloworld.c example in apps/plugins. It looks like you've missed a few things. For example your plugin must have

    PLUGIN_HEADER

somewhere in it.

As for the warning, "function declaration isn't a prototype" it means that your function declaration isn't valid. You've got

    int** CrearMundo() {

it should be

    int** CrearMundo(void) {

neoAKiRAz:
I did take a look at helloworld.c, but I must have missed that line... :P
Concerning the prototype, I usually forget differences between C and C++  :-\
I had to change a lot of "for (int i" and "function(int &var" too :) I'm not really sure why I can still use bool, true and false; I tought it was only a C++ datatype.

Okkk... now I'm getting this error:


--- Code: ---/home/rockbox/build/apps/plugins/my_plugin.o: In function `CrearMundo':
my_plugin.c:(.text+0x64): undefined reference to `malloc'
/home/rockbox/build/apps/plugins/my_plugin.o: In function `crearVibora':
my_plugin.c:(.text+0xf0): undefined reference to `malloc'
/home/rockbox/build/apps/plugins/my_plugin.o: In function `matarVibora':
my_plugin.c:(.text+0x874): undefined reference to `free'
collect2: ld returned 1 exit status
make[2]: *** [/home/rockbox/build/apps/plugins/my_plugin.elf] Error 1
make[1]: *** [rocks] Error 2
make: *** [all] Error 2
--- End code ---

in spite of including the line "#include $stdlib.h$" (less and more marks insted of $). Is it wrong to use dynamic memory for rockbox? Is there an stdlib availible for it?

saratoga:
You can't use malloc or free in Rockbox.  I believe memory must be statically allocated.

safetydan:
Welcome to the wonderful world of embedded software development. There is no malloc so you'll pretty much have to statically allocate things. If you really, really need a dynamic chunk of memory you can steal the audio buffer, but that's generally not needed (and stops audio playback anyway).

neoAKiRAz:
Great! Changing dynamic to static :P
It wasn't really needed in this case anyway...

I suppose there's no dynamic memory because of the much simpler OS that can be run in a embbeded system... I'm really curious about the 'art' of porting Rockbox, I'd like to know how it works.
I'm guessing most of the Rockbox source is written in C, and a compiler is made for every different CPU in each target... and then the libraries (meaning system calls for LCD, audio access, etc) may be partially made in assembly language. Is it something like that?

I'll keep working on this, greetz! And Thx.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version