Building loadp2
Can I please get some help building my own loadp2? Today I downloaded the loadp2-master.zip from https://github.com/totalspectrum/loadp2. The build instructions are pretty simple: make CROSS=win32
My system is Win11, Cygwin64. I installed MinGW to support this. I think I got everything important but usually just use Cygwin gcc, so I may have made a noob error. Other changes:
- grabbed propeller2.h from spin2cpp and placed it in board/sdcard
- changed the punctuation of propeller2.h from <> to "" in sd*.c
The published make command fails in flexspin of sdboot.c:>> make CROSS=win32
make -C board/sdcard P2CC="flexspin -2"
make[1]: Entering directory '/cygdrive/c/GlueLogix/Documents/ByVendor/Parallax/Prop2/CompilerLoaders/loadp2/loadp2-master/loadp2-master/board/sdcard'
flexspin -2 -o sdboot.binary sdboot.c ff.c sdmm.c
Propeller Spin/PASM Compiler 'FlexSpin' (c) 2011-2024 Total Spectrum Software Inc. and contributors
Version 6.9.4 Compiled on: Apr 22 2024
sdboot.c
error: Preprocessor errors:
C:/GlueLogix/Documents/ByVendor/Parallax/Prop2/CompilerLoaders/loadp2/loadp2-master/loadp2-master/board/sdcard/sdboot.c:6: error: Can't open include file "stdio.h"
#include <stdio.h>
C:/GlueLogix/Documents/ByVendor/Parallax/Prop2/CompilerLoaders/loadp2/loadp2-master/loadp2-master/board/sdcard/propeller2.h:4: error: Can't open include file "stdint.h"
#include <stdint.h>
from C:/GlueLogix/Documents/ByVendor/Parallax/Prop2/CompilerLoaders/loadp2/loadp2-master/loadp2-master/board/sdcard/sdboot.c: 7: #include "propeller2.h"
2 errors in preprocessor.
make[1]: *** [Makefile:8: sdboot.binary] Error 1
make[1]: Leaving directory '/cygdrive/c/GlueLogix/Documents/ByVendor/Parallax/Prop2/CompilerLoaders/loadp2/loadp2-master/loadp2-master/board/sdcard'
make: *** [Makefile:79: board/P2ES_sdcard.bin] Error 2
I added a -I path to the Makefile for the mingw stdio.h. Still failed, slightly different error:>> make CROSS=win32
make -C board/sdcard P2CC="flexspin -2 -I C:\cygwin64\usr\i686-w64-mingw32\sys-root\mingw\include"
make[1]: Entering directory '/cygdrive/c/GlueLogix/Documents/ByVendor/Parallax/Prop2/CompilerLoaders/loadp2/loadp2-master/loadp2-master/board/sdcard'
flexspin -2 -I C:\cygwin64\usr\i686-w64-mingw32\sys-root\mingw\include -o sdboot.binary sdboot.c ff.c sdmm.c
Propeller Spin/PASM Compiler 'FlexSpin' (c) 2011-2024 Total Spectrum Software Inc. and contributors
Version 6.9.4 Compiled on: Apr 22 2024
sdboot.c
error: Preprocessor errors:
C:/cygwin64/usr/i686-w64-mingw32/sys-root/mingw/include/_mingw.h:271: error: #error Only Win32 target is supported!
#error Only Win32 target is supported!
from C:/cygwin64/usr/i686-w64-mingw32/sys-root/mingw/include/corecrt.h: 10: #include <_mingw.h>
from C:/cygwin64/usr/i686-w64-mingw32/sys-root/mingw/include/corecrt_stdio_config.h: 10: #include <corecrt.h>
from C:/cygwin64/usr/i686-w64-mingw32/sys-root/mingw/include/stdio.h: 9: #include <corecrt_stdio_config.h>
from C:/GlueLogix/Documents/ByVendor/Parallax/Prop2/CompilerLoaders/loadp2/loadp2-master/loadp2-master/board/sdcard/sdboot.c: 6: #include <stdio.h>
C:/cygwin64/usr/i686-w64-mingw32/sys-root/mingw/include/vadefs.h:35: error: #error VARARGS not implemented for this compiler
#error VARARGS not implemented for this compiler
from C:/cygwin64/usr/i686-w64-mingw32/sys-root/mingw/include/_mingw.h: 282: #include <vadefs.h>
from C:/cygwin64/usr/i686-w64-mingw32/sys-root/mingw/include/corecrt.h: 10: #include <_mingw.h>
from C:/cygwin64/usr/i686-w64-mingw32/sys-root/mingw/include/corecrt_stdio_config.h: 10: #include <corecrt.h>
from C:/cygwin64/usr/i686-w64-mingw32/sys-root/mingw/include/stdio.h: 9: #include <corecrt_stdio_config.h>
from C:/GlueLogix/Documents/ByVendor/Parallax/Prop2/CompilerLoaders/loadp2/loadp2-master/loadp2-master/board/sdcard/sdboot.c: 6: #include <stdio.h>
2 errors in preprocessor.
make[1]: *** [Makefile:8: sdboot.binary] Error 1
make[1]: Leaving directory '/cygdrive/c/GlueLogix/Documents/ByVendor/Parallax/Prop2/CompilerLoaders/loadp2/loadp2-master/loadp2-master/board/sdcard'
make: *** [Makefile:79: board/P2ES_sdcard.bin] Error 2
Including the gcc header yielded a third error:> make CROSS=win32
make -C board/sdcard P2CC="flexspin -2 -I C:\cygwin64\usr\include"
make[1]: Entering directory '/cygdrive/c/GlueLogix/Documents/ByVendor/Parallax/Prop2/CompilerLoaders/loadp2/loadp2-master/loadp2-master/board/sdcard'
flexspin -2 -I C:\cygwin64\usr\include -o sdboot.binary sdboot.c ff.c sdmm.c
Propeller Spin/PASM Compiler 'FlexSpin' (c) 2011-2024 Total Spectrum Software Inc. and contributors
Version 6.9.4 Compiled on: Apr 22 2024
sdboot.c
error: Preprocessor errors:
C:/cygwin64/usr/include/machine/ieeefp.h:527: error: #error Endianess not declared!!
#error Endianess not declared!!
from C:/cygwin64/usr/include/sys/config.h: 4: #include <machine/ieeefp.h>
from C:/cygwin64/usr/include/_ansi.h: 11: #include <sys/config.h>
from C:/cygwin64/usr/include/stdio.h: 29: #include "_ansi.h"
from C:/GlueLogix/Documents/ByVendor/Parallax/Prop2/CompilerLoaders/loadp2/loadp2-master/loadp2-master/board/sdcard/sdboot.c: 6: #include <stdio.h>
C:/cygwin64/usr/include/machine/_default_types.h:25: error: Constant "9223372036854775807LL" is out of range
macro "LONG_LONG_MAX" defined as: #define LONG_LONG_MAX 9223372036854775807LL /* C:/cygwin64/usr/include/limits.h:106 */
from C:/cygwin64/usr/include/machine/_default_types.h: 25: #if ( defined(LONG_LONG_MAX) && (LONG_LONG_MAX > 0x7fffffff) ) || ( defined(LLONG_MAX) && (LLONG_MAX > 0x7fffffff) )
from C:/cygwin64/usr/include/sys/cdefs.h: 45: #include <machine/_default_types.h>
from C:/cygwin64/usr/include/stdio.h: 35: #include <sys/cdefs.h>
from C:/GlueLogix/Documents/ByVendor/Parallax/Prop2/CompilerLoaders/loadp2/loadp2-master/loadp2-master/board/sdcard/sdboot.c: 6: #include <stdio.h>
<10 more>
Hint? Help? I tried searching for "loadp2 build" and came up dry.
Comments
That just means your build environment is broken in some fundamental way unrelated to anything loadp2. Likely confused env from having cygwin and mingw versions of the same tools installed.
If you just want the latest loadp2, grab the latest flexprop and take it from the bin directory.
Which is why I tried explicitly providing include paths to flexspin, which just made things worse. I was hoping for a hint about what the tool might be looking for.
I did that in the course of my last thread https://forums.parallax.com/discussion/comment/1559174
Now I want to add a reset at the end of programming for reasons in that other thread. If the build were failing on mingw I wouldn't bother this group. But flexspin is the culprit here, not mingw, gcc or cygwin. As of now, flexspin is a black box to me. But I just built it, along with spin2cpp, so I guess I'll start there.
Sorry, the previous post was made on my phone and I didn't quite see what was going on. Your problem is that flexspin isn't finding it's C library includes. Providing your PC's C library is a bad idea and will never work, don't even try that. That was what confused me. Normally it should automatically find them if installed normally, by going one directory up from where the compiler executable is and then going into the
include
directory. (note that this works out-of-the-box if the flexspin.exe is left in thebuild
directory the linker spits it into - did you move it?)I use mingw32 which I installed using the MinGW installation manager.
\mingw32\bin
Mike
Of course, should have thought of that.
Well, yeah. The flexspin in my PATH is the executable from the flexprop tree, as recommended. I copied it to a Tools folder in the Windows PATH, that I use for standalone utilities.
This worked:
>make CROSS=win32 -I [path to P2 headers from spin2cpp or flexprop]
Thank you for your help in my last two issues.
This fixed my problem loading big Flash images:
if (loadfile(fname, address))
{
if (LOAD_SPI == load_mode)
{
hwreset(); // GlueLogix: reset target after Flash load
}
serial_done();
promptexit(1);
}
The addition is at the end of loadp2.c:main(), line 1214 of version 0.072.
@Wuerfel_21 (edit): Would you like me to go through the github fork/change/pull-request process? Should there be a command line switch, or is it safe to always do that after loading Flash?