HP Forums

Full Version: WP34s Builds
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm trying to build bin files from Windows 7. I've read a lot about it, installed and modified files as suggested by Nigel J Dowrick in his article. I've succeeded in building wp34s-lib file but had no success with calc.bin.

I keep getting this error message from flash-build log file:

Modification of non-creatable array value attempted, subscript -1 at c:\WP\bin\wp34s-code\tools\wp34s_asm.pl line 1891.
Makefile:402: recipe for target 'xrom.c' failed
mingw32-make[1]: *** [xrom.c] Error 25
mingw32-make[1]: Leaving directory 'C:/WP/bin/wp34s-code'
make: *** [realbuild/calc.bin] Error 2

I'm missing something here.

I'm using makeflash.cmd. I couldn't find flash.cmd anywhere so I guess it has been replaced by makeflash.

If someone could give me a hint in sloving this issue, I would appreciate it.

Patrick
(10-26-2014 05:16 PM)mendesp Wrote: [ -> ]Modification of non-creatable array value attempted, subscript -1 at c:\WP\bin\wp34s-code\tools\wp34s_asm.pl line 1891.

It is trying to assemble the XROM code with Neil's assembler. XROM is just a keystroke program to implement some of the built-in functionality.

Maybe Neil can chime in...
Could you please verify that you are using the actual revision of the script?
Code:
Path: tools/wp34s_asm.pl
Name: wp34s_asm.pl
URL: http://svn.code.sf.net/p/wp34s/code/trunk/tools/wp34s_asm.pl
Repository Root: http://svn.code.sf.net/p/wp34s/code
Repository UUID: 9654ca62-1852-461c-aa49-1be32f3bb02d
Revision: 3680
Node Kind: file
Schedule: normal
Last Changed Author: paulidale
Last Changed Rev: 3425
Last Changed Date: 2013-06-27 02:12:48 +0200 (Thu, 27 Jun 2013)
Text Last Updated: 2014-01-09 10:20:12 +0100 (Thu, 09 Jan 2014)
Checksum: 5c348f4629a92dc95be97d9f7e1348d5

tools/wp34s_asm.pl:
Code:
1877 #######################################################################
1878 #
1879 # Dump the output into a C-array.
1880 #
1881 sub dump_c_array {
1882   my $file = shift;
1883   my $leader = shift;
1884   my $indent_spaces = shift;
1885   my @val_array = @_;
1886   open OUT, "> $file" or die_msg(this_function((caller(0))[3]), "Could not open C-array file '$file' for writing: $!");
1887   print OUT "$leader\n";
1888   for my $hex_str (0 .. (scalar @val_array)-2) {
1889     printf OUT "%0s0x%04x,\n", " " x $indent_spaces, $val_array[$hex_str];
1890   }
1891   printf OUT "%0s0x%04x };\nconst unsigned short int xrom_size = sizeof(xrom) / sizeof(const s_opcode);\n", " " x $indent_spaces, $val_array[-1];
1892   close OUT;
1893   return;
1894 } # dump_c_array

I haven't executed the method dump_c_array but if I look at line 1891 there's only this statement that might lead to the aforementioned error message:

$val_array[-1]

But then this should only happen when we try to modify the array with an index that is out of range but not when it is just accessed:
Code:
  DB<1> @val_array = ();

  DB<2> x $val_array[-1]
0  undef
  DB<3> $val_array[-1] = 3;
Modification of non-creatable array value attempted, subscript -1 at (eval 10)[/usr/share/perl5/perl5db.pl:638] line 2.

Thus I don't think this might happen with the actual code.

HTH
Thomas
Thank you, Thomas for your reply. I'll have a look at this file and let you know if I could build the bins.
Thomas, you were right, I wasn't using the actual revision of the file. I still can't build the file as I get a different error:

xrom_pre.wp34s
// WP 34S assembly preprocessor enabled: '-pp'
// Opcode map source: tools/wp34s.op (specified)
// Opcode SVN version: -- unknown --
// Running WP 34S preprocessor from: C:/wp/bin/wp34s-code/tools/wp34s_pp.pl
AccŠs refus‚.
WARNING: wp34s_asm.pl::run_pp: WP 34S preprocessor failed. Temp file: '.__0.24468994140625.tmp'
ERROR: wp34s_asm.pl::run_pp: Perhaps you can try running it in isolation using: $ "C:/wp/bin/wp34s-code/tools/wp34s_pp.pl" -m 235 -cat .__0.24468994140625.tmp -v3 -xrom -e2so -sd 4 -colour_mode 0
Makefile:402: recipe for target 'xrom.c' failed
mingw32-make[1]: *** [xrom.c] Error 1
mingw32-make[1]: Leaving directory 'C:/WP/bin/wp34s-code'
make: *** [realbuild/calc.bin] Error 2

If this can help, it seems that the script can't run wp34s_pp.pl. A message box asks me if I want to open the file instaed of running it. In Makelib.cmd, I replaced the line
set LIB=%TOOLS%\wp34s_lib.pl -d %DEBUG% by
set LIB=%TOOLS%\wp34s_lib.exe -d %DEBUG%

to fix the issue. It worked but obviously this wasn't enough.

What should I modify to run pl scripts properly ?
Everything is working now. I had to fix a a file association issue.

Thanks for your help !

Congratulations for this fantastic project !!
In order to get some debug-information in tools/wp34s_asm.pl you can set:
Code:
 151 my $debug = 3;
Or then set the environment variable WP34S_ASM to PRESERVE_PP_DBG:

Code:
1848   print "// Running WP 34S preprocessor from: $pp_location\n";
1849   debug_msg(this_function((caller(0))[3]), "Running: '$cmd'")
1850     if ($debug > 2) or (exists $ENV{WP34S_ASM} and ($ENV{WP34S_ASM} =~ /PRESERVE_PP_DBG/i));
1851
1852   @lines = `$cmd`;
1853   $err_msg = $?;
1854   if( $err_msg ) {
1855     warn_msg(this_function((caller(0))[3]), "WP 34S preprocessor failed. Temp file: '$tmp_file'");
1856     die_msg(this_function((caller(0))[3]), "Perhaps you can try running it in isolation using: \$ $cmd");
1857   }
1858   unlink $tmp_file unless exists $ENV{WP34S_ASM} and ($ENV{WP34S_ASM} =~ /PRESERVE_PP_TMP/i);

But I must admit that I'm not familiar with the build-environment of this project.
Are you sure that your Perl installation is fine?

Completely unrelated:
Quote: # Override the step digits as required.
# XXX Hah! Who knew?! In Perl, 'log' is actually log2, not log10, like everywhere else!!
my $sd = ceil(log($max_flash_words)/log(10));

From perldoc -f log:
Code:
       log EXPR
       log     Returns the natural logarithm (base e) of EXPR.  If EXPR is omitted, returns log of $_.  To get the log of another base, use basic algebra: The base-N log of a number is equal to the natural log of that
               number divided by the natural log of N.  For example:

                   sub log10 {
                       my $n = shift;
                       return log($n)/log(10);
                   }

               See also "exp" for the inverse operation.
Oops, didn't notice that you could solve the problem in the meantime.

Cheers
Thomas
Well it's not quite over yet...

My calc.bin file is much smaller (116 Kb) than the original one (643 Kb).

Maybe I could try to disassemble the files and find what's missing. I probably missed something else that should be obvious.

I tried to add the flash-build log file to this post, but this type of file seems to be not allowed. Should I copy and paste the content to this post ?

Thanks,

Patrick
(10-27-2014 04:55 PM)mendesp Wrote: [ -> ]My calc.bin file is much smaller (116 Kb) than the original one (643 Kb).
116 KB for the calc.bin file is correct. It's just a binary image of the flash contents. The larger file calc (without the extension) is an intermediate file that is used by the hardware debugger.
So I guess I can flash my calculator with this file. Am I correct ?

Thanks a lot for your help!

Patrick
(10-27-2014 05:07 PM)mendesp Wrote: [ -> ]So I guess I can flash my calculator with this file. Am I correct ?
You can compare it to the image in the repository. If the differences are minor(*), you are on the safe side.

(*) If you didn't change the source code the difference should just be in the revision number which is encoded in the file.
Reference URL's