I was tempted to continue the AdditionAgent-thread, but decided not to.
I found out that the Canon UI related routines use a separate memory chunk for dynamic memory allocations. This chunk is allocated early in the boot process:
To find it, locate taskcreate_PhySw in the startup task. The routine above that calls some initialization functions, the first one allocates / initializes UI memory (can be identified by a "UiMemory.c" debugassert, and a call to malloc with 0x61a80 (400000 decimal) as allocation size). Edit: cameras with wide (960px) viewports have 0x927C0 (600000 decimal) bytes UI memory.
A sub-allocator is used for that memory chunk, its initializer function creates a semaphore named "pvm_alloc" (seems to exist on all DryOS cameras). The sub-allocator only seems to provide the 'malloc' and 'free' routines and an additional function that can retrieve the largest free block size (VxWorks cameras have a much more informative eventproc for this, called 'UiMemory_Show').
On newer cameras (such as the a3200), function pointers (located in RAM) are used to hold the allocator and de-allocator function addresses for UI memory.
Now the reason I'm posting this:
The UI memory chunk's size doesn't seem to be camera specific, it's 400000 bytes even on the old a410 (didn't check every camera, there can be exceptions). It might be possible to reduce its size (requires a small change in a port's boot.c), or use its allocator to allocate from it.
Possible risk: cameras operated for a prolonged time could use up the smaller available area faster than usual.
I have tried using the a3200 for a while with a debug display that shows the largest free UI mem chunk, the number went down to ~280k to the end (I was browsing various menus in play/rec mode). I used the following modification (no sigfinder support yet):
Index: core/main.c
===================================================================
--- core/main.c (revision 3359)
+++ core/main.c (working copy)
@@ -247,12 +247,13 @@
camera_info.state.state_shooting_progress = SHOOTING_PROGRESS_DONE;
}
- i = 0;
+ i = 3;
-#ifdef DEBUG_PRINT_TO_LCD
- sprintf(osd_buf, "%d", cnt ); // modify cnt to what you want to display
+//#ifdef DEBUG_PRINT_TO_LCD
+ extern int get_uimem_size();
+ sprintf(osd_buf, "uimem free: %d", get_uimem_size() ); // modify cnt to what you want to display
draw_txt_string(1, i++, osd_buf, conf.osd_color);
-#endif
+//#endif
if (camera_info.perf.md_af_tuning)
{
Index: platform/a3200/lib.c
===================================================================
--- platform/a3200/lib.c (revision 3359)
+++ platform/a3200/lib.c (working copy)
@@ -113,3 +113,11 @@
int vid_get_palette_type() { return 3; }
int vid_get_palette_size() { return 256 * 4; }
+
+
+int get_uimem_size()
+{
+ extern int _get_pvm_maxregion(int handle);
+ extern int uimem_handle;
+ return _get_pvm_maxregion(uimem_handle);
+}
Index: platform/a3200/sub/100d/stubs_entry_2.S
===================================================================
--- platform/a3200/sub/100d/stubs_entry_2.S (revision 3359)
+++ platform/a3200/sub/100d/stubs_entry_2.S (working copy)
@@ -12,3 +12,5 @@
NHSTUB(TurnOnMic, 0xFF8608E8)
NHSTUB(TurnOffMic, 0xFF860914)
NHSTUB(TurnOffE1, 0xff83bc20)
+
+NHSTUB(get_pvm_maxregion, 0xFF8114CC)
Index: platform/a3200/sub/100d/stubs_min.S
===================================================================
--- platform/a3200/sub/100d/stubs_min.S (revision 3359)
+++ platform/a3200/sub/100d/stubs_min.S (working copy)
@@ -1 +1,3 @@
#include "stubs_asm.h"
+
+DEF(uimem_handle, 0x30ac)