New tool for porting. - page 4 - General Discussion and Assistance - CHDK Forum

New tool for porting.

  • 40 Replies
  • 18522 Views
*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: New tool for porting.
« Reply #30 on: 12 / October / 2013, 23:10:33 »
Advertisements
I'm trying to use codegen on a long function that has a chunk of data in the middle (elph130 FF17D650 task_ComWireless). Since it's a task loop, I need the whole thing.

It seems like SKIP should skip over the data, but looking at the code, it looks like it still tries to disassemble it. If I've understood correctly, some of the data disassembles to a valid instruction with an invalid offset. With

edit: oops, there original code below had some arithmetic errors, :(  but they don't affect the result. Correct below.

Code: [Select]
FUNC sig=task_ComWireless name=task_ComWireless_my
ASM
FW 10
>>>
"LDR     R0, [SP,#4]\n"
"BL log_wireless_msg\n"
<<<
FW 135
SKIP 28
I get

Invalid firmware offset 2007437.
Source --> FUNC sig=task_ComWireless name=task_ComWireless_my

If I reduce skip to 6, it runs correctly. (edit, offset from old wrong values...)

I don't see any simple way to fix this in the codegen code.

What if you specify length on the FUNC line instead of letting it try and calculate it?

Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

*

Offline reyalp

  • ******
  • 14138
Re: New tool for porting.
« Reply #31 on: 12 / October / 2013, 23:22:21 »
The attached patch got most of what I wanted, although some labels toward the end of the function didn't get added for some reason.

specifying length doesn't help.
Don't forget what the H stands for.

*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: New tool for porting.
« Reply #32 on: 13 / October / 2013, 02:42:50 »
The attached patch got most of what I wanted, although some labels toward the end of the function didn't get added for some reason.

specifying length doesn't help.

Thanks for that.

Can you try the attached patch - I think it should avoid the issue and get all the labels.

Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

*

Offline reyalp

  • ******
  • 14138
Re: New tool for porting.
« Reply #33 on: 13 / October / 2013, 03:54:23 »
Thanks for that.

Can you try the attached patch - I think it should avoid the issue and get all the labels.

Phil.
That seems to work, thanks  :D
Don't forget what the H stands for.

Re: New tool for porting.
« Reply #34 on: 27 / April / 2014, 20:07:53 »
@philmoz : As I crash my way through my first port using code_gen (i.e. c&p from another port, hack until it builds, read docs in code_gen.c only as a last resort) I've come to think it would be nice if the error messages from places like chk_args() actually printed the offending line number in the input code_gen.txt file.

And yes,  I can probably fix it to do that myself after many false starts.   But if it's not too hard, and makes sense,  would you consider adding it?

MTIA

WW

Update :  yes - I've realized you can look at the generated files and pretty quickly work backwards to your syntax mistake. Still ....
« Last Edit: 27 / April / 2014, 20:17:54 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: New tool for porting.
« Reply #35 on: 27 / April / 2014, 20:28:50 »
@philmoz : As I crash my way through my first port using code_gen (i.e. c&p from another port, hack until it builds, read docs in code_gen.c only as a last resort) I've come to think it would be nice if the error messages from places like chk_args() actually printed the offending line number in the input code_gen.txt file.

And yes,  I can probably fix it to do that myself after many false starts.   But if it's not too hard, and makes sense,  would you consider adding it?

MTIA

WW

Update :  yes - I've realized you can look at the generated files and pretty quickly work backwards to your syntax mistake. Still ....

Added to my to-do list :)

Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

Re: New tool for porting.
« Reply #36 on: 27 / April / 2014, 20:31:59 »
Added to my to-do list :)
TIA - and please excuse me for not saying thanks for adding this functionality in the first place.
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: New tool for porting.
« Reply #37 on: 02 / May / 2014, 08:21:17 »
@philmoz : As I crash my way through my first port using code_gen (i.e. c&p from another port, hack until it builds, read docs in code_gen.c only as a last resort) I've come to think it would be nice if the error messages from places like chk_args() actually printed the offending line number in the input code_gen.txt file.

And yes,  I can probably fix it to do that myself after many false starts.   But if it's not too hard, and makes sense,  would you consider adding it?

MTIA

WW

Update :  yes - I've realized you can look at the generated files and pretty quickly work backwards to your syntax mistake. Still ....

Added in revision 3430.

Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

*

Offline srsa_4c

  • ******
  • 4451
Re: New tool for porting.
« Reply #38 on: 02 / May / 2014, 13:41:42 »
 :-[ Wrong thread, post belongs to the sigfinder thread
« Last Edit: 02 / May / 2014, 13:43:22 by srsa_4c »

*

Offline ADamb

  • **
  • 65
  • sx200is
Re: New tool for porting.
« Reply #39 on: 26 / September / 2014, 01:45:44 »
IMHO it would be nice to add comments to code lines (like REM, but leaving code line in place),
applying them after (or before) ASM/ENDASM block :
CMNT YYY "comment text"
so
/*YYY*/"    BL       sub_XXXXXXXX \n"
would be
/*YYY*/"    BL       sub_XXXXXXXX \n"  // comment text
SX200 IS-100C

 

Related Topics


SimplePortal © 2008-2014, SimplePortal