using the linker to calculate MEMISOSIZE automatically - General Discussion and Assistance - CHDK Forum

using the linker to calculate MEMISOSIZE automatically

  • 4 Replies
  • 4769 Views
*

Offline reyalp

  • ******
  • 14128
using the linker to calculate MEMISOSIZE automatically
« on: 20 / September / 2008, 19:54:27 »
Advertisements
It looks to me like we can completely automate this as follows:
change the link-boot.ld script to generate a symbol at the end of bss (e.g. _end). Make everything that refers to MEMISOSIZE refer to &_end - &_start

Done ;)

I tested this on my cam (with both diskboot and .fir), and it appears to work fine. Displaying the values of _start and _end give the correct values.

Am I missing something here ?

edit:
attached patch against trunk. Note, each platform needs a minor change, only a540 is done

debug->size stuff shows the values of _start (should = MEMISOSTART) _end (should = MEMISOSTART + size reported in build) and difference (should = size reported in build)

edit:
difference is what is used for MEMISOSIZE

edit:
updated patch, string for mbox shouldn't be on the stack  :-[

edit:
added full patch, will check in if no one one points out serious problems.
« Last Edit: 21 / September / 2008, 01:35:02 by reyalp »
Don't forget what the H stands for.

*

Offline PhyrePhoX

  • *****
  • 2254
  • make RAW not WAR
    • PhyreWorX
Re: using the linker to calculate MEMISOSIZE automatically
« Reply #1 on: 21 / September / 2008, 03:56:24 »
Damn,after whim,hacki and me put so much brains into reporting all used memiso and actual sizes into the logfile, you step in and make it obsolete by providing a much better solution. Hats off!

*

Offline whim

  • ******
  • 2046
  • A495/590/620/630 ixus70/115/220/230/300/870 S95
Re: using the linker to calculate MEMISOSIZE automatically
« Reply #2 on: 21 / September / 2008, 04:17:50 »
Another great improvement, thanks !

wim

PS still patching though, hoping to test soon

edit: done, seems to compile & run fine on i70_sd1000-101b:
free memory before 639.712 bytes, now 654.640

edit2: same for A630-100c:
free memory before 324.588 bytes, now 334.396
« Last Edit: 26 / September / 2008, 06:03:24 by whim »

*

Offline reyalp

  • ******
  • 14128
Re: using the linker to calculate MEMISOSIZE automatically
« Reply #3 on: 21 / September / 2008, 16:38:26 »
Checked in, changeset 521. Put size and start in misc->memory info.
Don't forget what the H stands for.

*

Offline reyalp

  • ******
  • 14128
Re: using the linker to calculate MEMISOSIZE automatically
« Reply #4 on: 25 / September / 2008, 22:08:32 »
Comments in dryos cams boot code seem to imply they need some extra space:
eg, a720-100c
Code: [Select]
//              "LDR     R0, =0xDD024\n"          // 0x9d024 + 0x40000, note: 0x20000 *should* have been enough, but our code was overwritten...
                                                // ...thus we push the memory pool a little more up (0x30000 = 192k)
        asm volatile (
              "LDR     R0, =new_sa\n"
              "LDR     R0, [R0]\n"
        );
We can still set memisosize automatically, but some platforms may need a camera specific additional amount. Having the extra padding specified separately will be safer anyway, since it won't get lost when the main image size changes.

We can add an area with a sentinel value after our BSS
Don't forget what the H stands for.

 

Related Topics


SimplePortal © 2008-2014, SimplePortal