- Status Closed
- Percent Complete
- Task Type Patches
- Category Operating System/Drivers
- Assigned To No-one
- Operating System All players
- Severity Low
- Priority Very Low
- Reported Version Daily build (which?)
- Due in Version Undecided
-
Due Date
Undecided
- Votes
- Private
FS#7264 - Build with -Os switch for coldfire targets.
This patch has a few different pieces.
0) Change the configure script to enable the -Os switch for m68k-elf-gcc.
1) It adds wrapper functions for memcpy and memset to some plugins to allow gcc to use those functions when optimizing.
2) Some small changes to playback_control to avoid memcpy here.
3) In playback.c change voicebuf to be unsigned char and adapt callbacks to this and make them accept the size parameter as size_t.
Both these changes were to avoid casting which made gcc throw a warning about dereferencing type-punned pointers.
Size drops about 20kb for rockbox.iriver for h300 builds.
I tested a build on my player and everything works as far as i can see.
Test built for a number of other targets without errors too.
I would like if some playback guru out there could take a look at this to see if my changes seem ok, i’m not very confident with changing playback.c and mp3_playback.c…
I tried to build with -O2 too but it fails on IRAM_FULL for the nsf codec.
Loading...
Available keyboard shortcuts
- Alt + ⇧ Shift + l Login Dialog / Logout
- Alt + ⇧ Shift + a Add new task
- Alt + ⇧ Shift + m My searches
- Alt + ⇧ Shift + t focus taskid search
Tasklist
- o open selected task
- j move cursor down
- k move cursor up
Task Details
- n Next task
- p Previous task
- Alt + ⇧ Shift + e ↵ Enter Edit this task
- Alt + ⇧ Shift + w watch task
- Alt + ⇧ Shift + y Close Task
Task Editing
- Alt + ⇧ Shift + s save task
hmmm, forgot to bump plugin api version, that can be done when (if?) this gets committed.
new patch,
* change the voice_info struct to have the same types as voicebuf and the size parameters to get rid of some uglyness
* bumped plugin api
Would really like to get someone else to test this, both on coldfire and archos targets
and some plaback.c guru to take a quick look at the changes in there too.
* Moved the wrapper functions to a macro called MEM_FUNCTION_WRAPPERS(api)
Have you tried putting the wrappers in the codec lib?
Magnus, Yes I tried that and it worked, but there was one nasty thing. I had to call an
init function to point the api pointer correctly (like in playback_control.c for example).
Doing that worked fine but if I did not do it the linker didn't complain because the plugins
are linked against everything in the plugin lib and the plugins just froze when they were run.
The bad thing is that gcc decides itself which plugins should use the mem* functions and some
arbitrary change might trigger it which then will cause the plugin to freeze, not nice.
A workaround would be to add the init call to every plugin but I thought this was nicer.
I would like to hear suggestions on how to make it better though
hmm, I wanted to try another idea, to add the mem* functions themselves to the pluginlib, that did not work however.
I added
../../../firmware/common/memcpy.c
../../../firmware/common/memset.c
to the end of apps/plugins/lib/SOURCES
and everything compiled fine but plugins using any of the two functions froze when started…
as a test I also copied the .c files to the lib dir and changed SOURCES accordingly but with the same result.
Is it worth it to continue trying to make that work or should we go with one of the other ways?