You should be able to use CTC++ with only a few or a few dozens bytes RAM. This is obtained by radically using the counter-arrays elements to bit size, removing the other auxiliary data instrumented in and removing the needage of the targ*.c target library files on the target itself.
CTC_array[]In one of your source files add at global scope
unsigned char CTC_array[0x100] = {0};
where 0x100 is an example of the minimum size needed for the array.
To estimate the size of the array, just make a "test compile" of the project and run on the generated MON.sym file following:
ctcpost -L MON.sym | any2mem
You see the size in bits, round up, add a little for safety and future code extensions.
(As an alternative, if you exactly know that a memory part is unused, e.g. memory starting at 0x9000 is unused, you can just add the start address -DCTC_ARRAY=0x9000 to OPT_ADD_COMPILE... Attention, you have to ensure, that this memory part is zero-initialised!)
unsigned char CTC_array[0x100] = {0};
where 0x100 is the estimated size needed for the array.
MON.aux CTC_DATA_PATH to some appropriate top-level directory.
The file MON.aux must initially be deleted, then the
application has to be rebuild. The files can be re-build,
if the amount of counters hasn't changed (e.g. not added/removed
an if-statement in the meantime). In doubt, make clean, remove MON.aux.
The functionality of
ctc_append_all()
#pragma CTC APPEND
EMBED_FUNCTION_NAME
If you want them back for whatever reasons, feel free to have a look in huge_targets sub-directory here.
The in the Host-Target Package described method atexit() will not work.
If you can for example dump this array in textual form, with e.g. right-clicking on that variable and save-as (or copy to clipboard), save it to a text-file MON.hexdump and it should be easy to write a script or tool to convert it back 1-to-1 in a binary file MON.dmp
MON.dmp and as second argument the MON.aux containing auxiliary data.
dmp2txt MON.dmp MON.aux > MON.txt
The resulting textual output is suitable for input for the ctc2dat utility.
dmp2txt MON.dmp MON.aux | ctc2dat
(Illustration)
+------------------------+ +------------------------+
| Array/Memory at target | | MON.aux (compile time) |
+------------------------+ +------------------------+
| |
| transfer |
V |
+------------------------+ |
| MON.dmp (dump array) | |
+------------------------+ |
| |
+----------------------------------+
|
V
+--------------------+
| dmp2txt |
+--------------------+
|
V
+--------------------+
| ctc2dat |
+--------------------+
|
V
+--------------------+
| regular MON.dat |
+--------------------+
Just proceed from here on as described in CTC++ User's Guide.
CTC_array[]
ctc2dat utility.
ctc2static is the CTC_AFTER_INSTR script, run only internally