This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

RTS430.lib - please go away! Or, how do I NOT pull in malloc...

Howdy folks - 

I swear I searched the forum, etc. but I can't find any hints on how to only pull in the bare minimum from RTS. In fact, I saw someone ask a similar question last year, but they didn't get a response and gave up. We could really use every byte of RAM for this project however...

We are using C++, but we don't use any heap, and heap is set to zero (the .map file shows only four bytes in .sysmem which is consistent with that). Those 4 bytes are coming from memory.c 

.sysmem    0    00000354    00000004     UNINITIALIZED
00000354 00000004 rts430.lib : memory.obj (.sysmem)
And here's everything we're pulling in from rts... yes - we do need the float related stuff... 

0000d570    00000130     rts430.lib : fs_add.obj (.text)
0000dd7a 000000ce rts430.lib : vec_newdel.obj (.text:array_new_general__FP...)
0000df0a 000000c2 rts430.lib : fs_mpy.obj (.text)
0000e1ba 0000009a rts430.lib : fs_div.obj (.text)
0000e6cc 00000068 rts430.lib : fs_toi.obj (.text)
0000e852 0000005c rts430.lib : lsr32.obj (.text:l_lsr_const)
0000e908 00000058 rts430.lib : div32u.obj (.text)
0000ebe8 0000004c rts430.lib : lsr16.obj (.text)
0000ec7e 0000004a rts430.lib : fs_cmp.obj (.text)
0000ed58 00000046 rts430.lib : fs_tou.obj (.text)
0000ef9c 0000003a rts430.lib : memory.obj (.text:minit)
0000f044 00000036 rts430.lib : vec_newdel.obj (.text:__anew)
0000f1b2 00000032 rts430.lib : fs_ultof.obj (.text)
0000f2f8 0000002c rts430.lib : asr16.obj (.text)
0000f46a 00000026 rts430.lib : mult32.obj (.text)
0000f4b4 00000024 rts430.lib : fs_utof.obj (.text)
0000f62e 00000016 rts430.lib : div16u.obj (.text)
0000f694 00000014 rts430.lib : mult16.obj (.text)
0000f756 00000008 rts430.lib : memzero.obj (.text:__memzero)
0000f792 00000004 rts430.lib : exit.obj (.text:abort)
0000f79a 00000002 rts430.lib : _lock.obj (.text:_nop)
Any pointers on how to take more control of this? Or should I just close my eyes and think of England? :)
  • Something is pulling in the C++ array new operator.  Are you sure your program does not use this operator?

  • Actually - I was puling in the __anew function... and malloc (no surprise!)

    How I found this was by setting the Runtime Library to <none> and the looking at what modules complained. Ran the .asm files through the demangler (dem430) and started hunting things down. 

    The memcpy was from an assignment of foo = *(fooPtrFx)(..), making an assignment operator fixed that, the _anew was from a: foo bar[2]; declaration. I removed the constructors for type foo, and viola.

    And then I put the library back to automatic and proceeded on my merry way.