FS#12403 - INIT_ATTR for SH Archos HWCODEC targets
Opened by Boris Gjenero (dreamlayers) - Wednesday, 23 November 2011, 20:06 GMT
I saw that INIT_ATTR isn't implemented HWCODEC targets so I decided to implement it. This patch consists of several parts, which could be split if desired.
- Rewriting of SH crt0.S to copy and fill sections using a list of values in memory instead of repeated code. This adds an insignificant bit of overhead between operations, but the actual loops themselves are as fast as before. (Using copy and paste to create .init copying code felt wrong, and SH assembler was intriguing.)
- Enabling INIT_ATTR by editing config.h, adding the section to linker scripts, and copying .init in crt0.S.
- Changes to allow use of the plugin buffer for INIT_ATTR. Normally, the codec buffer would be used, but HWCODEC targets don't have a codec buffer. In skin_data_load, buffer space is obtained from plugin_get_buffer. This buffer would otherwise overwrite INIT_ATTR code. The code only uses a small fraction of the buffer, and plenty remains for other uses.
- Adding INIT_ATTR mp3_init and functions only called from it.
This is currently a bit detrimental for RomBox. Initialization code in flash does not use RAM, and code added to implement this uses a bit of additional flash space. I didn't even test RomBox because I don't know how to fit current versions of Rockbox in ROM on my Recorder v2. However, I have in idea on how this could help RomBox in the future: .data and .init could be UCL packed to save flash space.
BTW While reviewing Archos target specific code for INIT_ATTR addition, I saw that the following functions could probably use INIT_ATTR:
button_init_device(), but it's declared in many header files
usb_init_device(), but it's declared in many header files
system_init() for CONFIG_CPU != SH7034 (due to rolo)
i2c_init() for CONFIG_CPU != SH7034 (due to rolo)