Canon PowerShot A4000 IS CHDK - page 2 - CHDK Releases - CHDK Forum

Canon PowerShot A4000 IS CHDK

  • 14 Replies
  • 13096 Views
*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: Canon PowerShot A4000 IS CHDK
« Reply #10 on: 24 / May / 2012, 05:46:10 »
Advertisements
I've just started port and met some problem with pass parameter to strlen() function:

Code: [Select]
{
      const char *test_text[] =
      {
        "CHDK'" HDK_VERSION " " BUILD_NUMBER "'" ,
        "Build: " __DATE__ " " __TIME__ ,
        "Camera: " PLATFORM " - " PLATFORMSUB
      };

      unsigned int w;

      for(i = 0; i< 3; i++)
        w = strlen(test_text[i]);
}

w is 0 always.

Code: [Select]
w = strlen(test_text[0]);
w = strlen(tets_text[1]);
w = strlen(test_text[2]);

w is right...

a810 has the same problem (release #0050 [2.59], DIGIC4  for both cams)

How are you testing the value of 'w' in the above two test cases?
Perhaps post a more complete test code so we can try it on other cameras.

Possibly this is the compiler optimising out some of the code - if I take your first code block and insert it into the CHDK code the compiler will optimise it away because the code has no outputs or side effects.

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 alvm

  • ***
  • 123
Re: Canon PowerShot A4000 IS CHDK
« Reply #11 on: 24 / May / 2012, 06:04:09 »
Quote
How are you testing the value of 'w' in the above two test cases?
Perhaps post a more complete test code so we can try it on other cameras.

The first test is a part of chdk draw logo procedure - it works fine for all cameras which use chdk. When I started a4000/a810 porting I met hor size of logo's area is very small. I've found that
Code: [Select]
strlen(test_text[i]) returns 0 for both cams. If I use const 0,1,2 instead var i strlen() returns right value and logo is ok. In addition I checking value of w by ptp.
« Last Edit: 24 / May / 2012, 06:11:10 by alvm »

*

Offline reyalp

  • ******
  • 14121
Re: Canon PowerShot A4000 IS CHDK
« Reply #12 on: 25 / May / 2012, 00:01:00 »
Quote
Either your test case is invalid somehow, or something in your build is very very broken.
The test code is the same. A compiler is the same. Address of strlen() is right. A800, A495 work fine but A4000, A810 not. What can be wrong? I think the problem is common for some set of functions not only for strlen().
Look at the code you posted. Unless the camera is malfunctioning, R0 will contain the length of the string (or 0 for a null pointer). There is no possible way for it to know if it's called in a loop or not (it doesn't even use the stack!).

So whatever your problem is, it's happening on the CHDK side. If the same toolchain works on other cameras, the most likely candidate would probably be memory corruptions of some kind.
Don't forget what the H stands for.

*

Offline alvm

  • ***
  • 123
Re: Canon PowerShot A4000 IS CHDK
« Reply #13 on: 31 / May / 2012, 15:13:59 »
Just for info. Using gcc-3.4.5 mingw under Windows and gcc-4.3.3 from Sourcery Lite 2009q1 toolchain under Linux give the same result.


*

Offline alvm

  • ***
  • 123
Re: Canon PowerShot A4000 IS CHDK
« Reply #14 on: 06 / June / 2012, 15:44:25 »
Quote
So whatever your problem is, it's happening on the CHDK side. If the same toolchain works on other cameras, the most likely candidate would probably be memory corruptions of some kind.


I'm sorry... Very, very stupied mistake :'(:

 "LDR    R0, =new_sa\n"   // +
 "LDR     R0, [R0]\n"     <---------------------- this string was missed for a810 and a4000 booting sequience...

« Last Edit: 06 / June / 2012, 15:46:31 by alvm »

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal