picocomputer / vscode-cc65

New Project Template for CC65
8 stars 6 forks source link

having trouble with windows and vs code setup #2

Open midicdj1000 opened 1 year ago

midicdj1000 commented 1 year ago

HI, I just built my picocomputer and I am trying to setup on windows with vs code. when I press F7 this is my output [main] Building folder: picotest1-main [build] Starting build [proc] Executing command: "C:\Program Files\CMake\bin\cmake.exe" --build c:/pico6502/picotest1-main/build --config Debug --target all -j 18 -- [build] [ 3%] Building ASM object rp6502-sdk/CMakeFiles/rp6502.dir/src/crt0.s.obj [build] [ 7%] Building C object rp6502-sdk/CMakeFiles/rp6502.dir/src/close.c.obj [build] [ 11%] Building ASM object rp6502-sdk/CMakeFiles/rp6502.dir/src/initenv.s.obj [build] [ 14%] Building C object rp6502-sdk/CMakeFiles/rp6502.dir/src/lseek.c.obj [build] [ 18%] Building ASM object rp6502-sdk/CMakeFiles/rp6502.dir/src/mainargs.s.obj [build] [ 22%] Building C object rp6502-sdk/CMakeFiles/rp6502.dir/src/open.c.obj [build] [ 25%] Building ASM object rp6502-sdk/CMakeFiles/rp6502.dir/src/oserrlist.s.obj [build] C:/pico6502/picotest1-main/rp6502-sdk/src/lseek.c(11): Error: Include file 'errno.h' not found [build] 2 errors and 0 warnings generated. [build] C:/pico6502/picotest1-main/rp6502-sdk/src/lseek.c(25): Error: Call to undeclared function '_mappederrno' [build] make[2]: *** [rp6502-sdk/CMakeFiles/rp6502.dir/build.make:127: rp6502-sdk/CMakeFiles/rp6502.dir/src/lseek.c.obj] Error 1 [build] make[2]: *** Waiting for unfinished jobs.... [build] [ 29%] Building ASM object rp6502-sdk/CMakeFiles/rp6502.dir/src/oserror.s.obj [build] [ 33%] Building C object rp6502-sdk/CMakeFiles/rp6502.dir/src/read.c.obj [build] [ 37%] Building C object rp6502-sdk/CMakeFiles/rp6502.dir/src/randomize.c.obj [build] C:/pico6502/picotest1-main/rp6502-sdk/src/read.c(2): Error: Include file 'errno.h' not found [build] C:/pico6502/picotest1-main/rp6502-sdk/src/read.c(17): Error: Call to undeclared function '_mappederrno' [build] 2 errors and 0 warnings generated. [build] make[2]: *** [rp6502-sdk/CMakeFiles/rp6502.dir/build.make:192: rp6502-sdk/CMakeFiles/rp6502.dir/src/read.c.obj] Error 1 [build] make[1]: *** [CMakeFiles/Makefile2:126: rp6502-sdk/CMakeFiles/rp6502.dir/all] Error 2 [build] make: *** [Makefile:91: all] Error 2 [build] Build finished with exit code 2

I have made sure my project has the correct files in rp6502-sdk new install of cc65 I am a casual programmer and don't use vscode all that much, but I did use cc65 for the c64.

also not sure what to do with the pyserial and my device manager has a issue with the device picoprobe pyserial

midicdj1000 commented 1 year ago

Just a note to say the python upload worked for basic.py after I changed the monitor port to windows com3.

rumbledethumps commented 1 year ago

Picoprobe is only used for developing the Pi Pico software. It's OK to not have a device driver for 6502 development. It's also OK to not have a device driver if you're using USB/IP.

EhBASIC doesn't have a maintainer right now. It needs to be updated for the SDK which has arguments for selecting the serial port.

I don't think anyone is using the SDK under Windows right now. If they are, they haven't shared any documentation.

Congratulations on the successful build.

midicdj1000 commented 1 year ago

I made some progress on the vscode and the errno.h error was because it couldn't find the cc65 include files and I am not show how to fix that so I just copied them into the project include. Next problem is Unresolved external 'mappederrno' referenced and Unresolved external 'seterrno' referenced in:

then not sure how to connect it via the terminal. [main] Building folder: picotest1-main [build] Starting build [proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --build c:/pico6502/picotest1-main/build --config Debug --target all -j 18 -- [build] [ 48%] Built target rp6502 [build] [ 51%] Linking C executable hello [build] Unresolved external '___mappederrno' referenced in: [build] C:/pico6502/picotest1-main/rp6502-sdk/src/write.s(254) [build] C:/pico6502/picotest1-main/rp6502-sdk/src/write.s(118) [build] C:/pico6502/picotest1-main/rp6502-sdk/src/read.s(282) [build] C:/pico6502/picotest1-main/rp6502-sdk/src/read.s(102) [build] C:/pico6502/picotest1-main/rp6502-sdk/src/open.s(134) [build] C:/pico6502/picotest1-main/rp6502-sdk/src/lseek.s(205) [build] C:/pico6502/picotest1-main/rp6502-sdk/src/lseek.s(110) [build] C:/pico6502/picotest1-main/rp6502-sdk/src/close.s(60) [build] Unresolved external '___seterrno' referenced in: [build] C:/pico6502/picotest1-main/rp6502-sdk/src/open.s(55) [build] ld65: Error: 2 unresolved external(s) found - cannot create output file [build] make[2]: *** [CMakeFiles/hello.dir/build.make:276: hello] Error 1 [build] make[1]: *** [CMakeFiles/Makefile2:100: CMakeFiles/hello.dir/all] Error 2 [build] make: *** [Makefile:91: all] Error 2 [build] Build finished with exit code 2

midicdj1000 commented 1 year ago

what does $ git submodule update --init do ? That is the only part I have not run

midicdj1000 commented 1 year ago

I am still suck with these errors [build] Unresolved external '___mappederrno' referenced in: [build] C:/pico6502/picotest1-main/rp6502-sdk/src/write.s(254) [build] C:/pico6502/picotest1-main/rp6502-sdk/src/write.s(118) [build] C:/pico6502/picotest1-main/rp6502-sdk/src/read.s(282) [build] C:/pico6502/picotest1-main/rp6502-sdk/src/read.s(102) [build] C:/pico6502/picotest1-main/rp6502-sdk/src/open.s(134) [build] C:/pico6502/picotest1-main/rp6502-sdk/src/lseek.s(205) [build] C:/pico6502/picotest1-main/rp6502-sdk/src/lseek.s(110) [build] C:/pico6502/picotest1-main/rp6502-sdk/src/close.s(60)

[build] Unresolved external '___seterrno' referenced in: [build] C:/pico6502/picotest1-main/rp6502-sdk/src/open.s(55)

from write.s if (ax < 0) return _mappederrno(RIA_ERRNO_LO);

from errno.h

if __CC65_STD >= CC65_STD_CC65__

/ define the name with just one underscore for backwards compatibility /

define _mappederrno __mappederrno

endif

so it my problem still related to the cc65 librarys ?

rumbledethumps commented 1 year ago

Yes, a lot of these errors look like problems finding the CC65 includes. https://github.com/picocomputer/rp6502-sdk/blob/882173aefd62373d2a39e6b38f2720e2eae3b40b/CMakeLists.txt#L8-L12

thegouldfish commented 1 year ago

Was trying to help and got an environment under windows working. but I was getting a linker error, not sure if something has changed with CC65. but I had to edit the oserror.s as the linker was looking for _osmaperrno where what it had was: osmaperrno

notice the 2 _ rather then the 3 the compiler and errno.inc was asking for .global ___osmaperrno

rumbledethumps commented 1 year ago

So much for stability and backwards compatibility of 20 year old software. https://github.com/cc65/cc65/commit/5d390489a8f754abfd032af858b6ed5686553187

midicdj1000 commented 1 year ago

After adding this to the cmakelists.txt if(DEFINED ENV{CC65_INCLUDE}) set(CC65_INCLUDE $ENV{CC65_INCLUDE}) else() set(CC65_INCLUDE "c:\pico6502\cc65\include") endif()

this one worked [build] [ 3%] Building ASM object rp6502-sdk/CMakeFiles/rp6502.dir/src/crt0.s.obj

this one has the Errol when it uses my local project C:/pico6502/picotest1-main/rp6502-sdk/src/write.s(254)

it compiled ok until it tried to link build] [ 92%] Building C object CMakeFiles/hello.dir/rp6502-sdk/src/write.c.obj [build] [ 96%] Building C object CMakeFiles/hello.dir/rp6502-sdk/src/randomize.c.obj [build] [100%] Linking C executable hello [build] Unresolved external '___mappederrno' referenced in: [build] C:/pico6502/picotest1-main/rp6502-sdk/src/write.s(254)

could cygwin64 have anything to so with it ? CMAKE_ADDR2LINE:FILEPATH=C:/cygwin64/bin/addr2line.exe

midicdj1000 commented 1 year ago

Capture with helps from @thegouldfish and @rumbledethumps I have the hello world compiled and uploaded.

Next is trying to document everything.

rumbledethumps commented 1 year ago

Looking at both versions of the online docs (sigh) it seems like the Windows installer may (or may have in the past) set the CC65_HOME environment variable. If it doesn't, or you need CC65 somewhere else like drive D:, then setting this environment variable is much better then editing the SDK CMakeLists.txt.

https://github.com/picocomputer/rp6502-sdk/blob/b1343f48e3bc1117720bd0064af26ab47ed99e14/CMakeLists.txt#L8-L12

It's also possible to configure this in VSCode settings.json instead of your OS environment:

"cmake.configureEnvironment": {
    "CC65_HOME": "D:/CC65"
},
midicdj1000 commented 1 year ago

Thanks, I have setup a VM with windows and have recorded a setup that worked start to end.

midicdj1000 commented 1 year ago

I have a video showing how I setup VScode

https://youtu.be/zJpz16XDL9c