x
This website is using cookies. We use cookies to ensure that we give you the best experience on our website. More info. That's Fine
HPC:Factor Logo 
 
Latest Forum Activity

Using VS Code for Windows CE C++ dev

Karpour Page Icon Posted 2021-04-06 2:03 AM
#
Avatar image of Karpour
Subscribers
H/PC Philosopher

Posts:
439
Location:
Austria
Status:
I've long wondered whether this was practical, but it turns out, it's very much possible

Here's what I did:
- Set up standard Win2k install in Virtualbox
- Install embedded Visual C++
- Add shared Projects Folder between host and VM
- Install old version of cygwin + openssh in VM
- Add SSH port forwarding
- Copy header files from Win2k machine to some folder on my host
- Create new VSCode workspace, add headerfiles in the config, set c++ standard to C++98, add some defines needed for CE

voila! I can now write code with all the conveniences of Intellisense and code checking in VS Code, while the compiler and all other CE-related tools happily run inside the VM





(Capture.PNG)



Attachments
----------------
Attachments Capture.PNG (348KB - 0 downloads)
 Top of the page
ntware Page Icon Posted 2021-04-06 2:45 AM
#
Avatar image of ntware
H/PC Elite

Posts:
660
Location:
Florida, US
Status:
This is REALLY cool! Could you be more descriptive about which header files you copied from the W2K VM and how you setup your workspace in VSCode? I've always wanted to build a port of some modern VNC client app for WinCE but was afraid of doing it in 2021 with no documentation available on the interwebs. Now with intellisense things get a lot better!
 Top of the page
C:Amie Page Icon Posted 2021-04-06 9:45 AM
#
Avatar image of C:Amie
Administrator
H/PC Oracle

Posts:
17,950
Location:
United Kingdom
Status:
Karpour,

I'd definitely love to publish a full how-to guide on this if you'd be willing to write it?
 Top of the page
Karpour Page Icon Posted 2021-04-06 3:50 PM
#
Avatar image of Karpour
Subscribers
H/PC Philosopher

Posts:
439
Location:
Austria
Status:
Yup, I'm all for it!

It'll be for Virtualbox though since I couldn't make Hyper-V do all the things I wanted easily. Advantage is that the setup will work both on Windows and Linux that way! I'll try to write something up soon!
 Top of the page
Karpour Page Icon Posted 2021-04-06 11:58 PM
#
Avatar image of Karpour
Subscribers
H/PC Philosopher

Posts:
439
Location:
Austria
Status:
Whew, still somewhat messy, but I managed to got most errors figured out. It seems a lot of files are always included by default, so to make sure you don't get lots of errors when opening windows ce .h files for reference, I created a separate VS Code config for the includes folder:

{ 
    "configurations": [ 
{
"name": "WinCE 2.11 ARM",
"forcedInclude": [
"${workspaceFolder}/windef.h",
"${workspaceFolder}/types.h",
"${workspaceFolder}/wtypes.h",
"${workspaceFolder}/winnt.h",
"${workspaceFolder}/windows.h",
"${workspaceFolder}/ocidl.h",
"${workspaceFolder}/replfilt.h",
"${workspaceFolder}/ipexport.h",
"${workspaceFolder}/mmreg.h",
"${workspaceFolder}/stdlib.h",
"${workspaceFolder}/msgstor2.h"
],
"defines": [
"${default}",
"UNDER_CE",
"_X86_",
"_WCHAR_T_DEFINED"
],
"intelliSenseMode": "windows-msvc-x86",
"cppStandard": "c++98",
"cStandard": "c99"
}
],
"version": 4
}


It works great! As someone who has never done much with the regular windows API, it makes things 100x easier when I can quickly follow references, get to the root of typedefs and have fancy autocomplete features
 Top of the page
stingraze Page Icon Posted 2021-04-08 6:28 AM
#
Avatar image of stingraze
H/PC Vanguard

Posts:
3,656
Location:
Japan
Status:
Great work!
So, this means that you're offloading compilation on Windows 2000? sweet.

Edited by stingraze 2021-04-08 6:29 AM
 Top of the page
Karpour Page Icon Posted 2021-04-08 10:43 PM
#
Avatar image of Karpour
Subscribers
H/PC Philosopher

Posts:
439
Location:
Austria
Status:
Yeah I did, I figured it wasn't worth trying to go through the headache of trying to get eVC + all the tools work on Windows 10.
Sadly eVC does not - as far as I know - provide and CLI options for building a project, otherwise I could integrate it into VS Code. If anyone has ideas on how I could build from CLI, suggestions are welcome.


I ran into some issues where after running autoformat in VSCode, eVC++ gives me loads of errors when compiling, no idea what's up. It replaces tabs with spaces, which should be fine.. Maybe it does something to the line breaks.. No idea, I'll have to try around
 Top of the page
Karpour Page Icon Posted 2021-04-08 11:01 PM
#
Avatar image of Karpour
Subscribers
H/PC Philosopher

Posts:
439
Location:
Austria
Status:
Mystery solved, clangformat somehow took the liberty to re-order the includes. I turned it off and it works fine now
 Top of the page
C:Amie Page Icon Posted 2021-04-09 10:49 AM
#
Avatar image of C:Amie
Administrator
H/PC Oracle

Posts:
17,950
Location:
United Kingdom
Status:
Do you think this could be bundled into a VS Code extension? We could GitHub it, perhaps encourage some more development.

I imagine that clxxx.exe do support command line parameters, but I doubt they are documented. Process tracing during a compile will probably reveal all.

These are the CE 2.11 options for clarm.exe

Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8274.0     for ARM 
Copyright (C) Microsoft Corp 1984-1998. All rights reserved. 

C/C++ COMPILER OPTIONS

-OPTIMIZATION-

/O1 minimize space /Oi enable intrinsic functions
/O2 maximize speed /Op[-] improve floating-pt consistency
/Oa assume no aliasing /Os favor code space
/Ob<n> inline expansion (default n=0) /Ot favor code speed
/Od disable optimizations (default) /Ow assume cross-function aliasing
/Og enable global optimization /Ox maximum opts. (/Ogitb1 /Gs)

-CODE GENERATION-

/Gf enable string pooling /QRarch4 ARM4 Architecture (no Thumb)
/GF enable read-only string pooling /QRarch4T ARM4T Architecture (Thumb)
/Gy separate functions for linker /QRinterwork-return ARM<-->Thumb calls

-OUTPUT FILES-

/Fa[file] name assembly listing file /Fo<file> name object file
/FA[sc] configure assembly listing /Fp<file> name precompiled header file
/Fd[file] name .PDB file /Fr[file] name source browser file
/Fe<file> name executable file /FR[file] name extended .SBR file
/Fm[file] name map file
(press <return> to continue)

-PREPROCESSOR-

/C don't strip comments /FI<file> name forced include file
/D<name>{=|#}<text> define macro /U<name> remove predefined macro
/E preprocess to stdout /u remove all predefined macros
/EP preprocess to stdout, no #line /I<dir> add to include search path
/P preprocess to file /X ignore "standard places"

-LANGUAGE-

/Zi enable debugging information /Zl omit default library name in .OBJ
/Z7 enable old-style debug info /Zg generate function prototypes
/Zd line number debugging info only /Zs syntax check only
/Zp[n] pack structs on n-byte boundary /vd{0|1} disable/enable vtordisp
/Za disable extensions (implies /Op) /vm<x> type of pointers to members
/Ze enable extensions (default) /noBool disable "bool" keyword

-MISCELLANEOUS-

/?, /help print this help message /V<string> set version string
/c compile only, no link /w disable all warnings
/H<num> max external name length /W<n> set warning level (default n=1)
/J default char type is unsigned /WX treat warnings as errors
(press <return> to continue)
/nologo suppress copyright message /Yc[file] create .PCH file
/Tc<source file> compile file as .c /Yd put debug info in every .OBJ
/Tp<source file> compile file as .cpp /Yu[file] use .PCH file
/TC compile all files as .c /YX[file] automatic .PCH
/TP compile all files as .cpp /Zm<n> max memory alloc (% of default)

-LINKING-

/MC link with COREDLL.LIB, CORELIBC.LIB /LDd Create .DLL debug libary
/ML link with COREDLL.LIB, LIBC.LIB /F<num> set stack size
/LD Create .DLL /link [linker options and libraries]

-NOT SUPPORTED IN THIS RELEASE-

/Gd __cdecl calling convention /Gi[-] enable incremental compilation
/Gr __fastcall calling convention /Gm[-] enable minimal rebuild
/Gz __stdcall calling convention /EHs enable synchronous C++ EH
/GA optimize for Windows Application /EHa enable asynchronous C++ EH
/GD optimize for Windows DLL /EHc extern "C" defaults to nothrow
/GZ enable runtime debug checks /ZI enable Edit & Continue debug info
/Ge force stack checking for all funcs /MD link with MSVCRT.LIB
/Gs[num] disable stack checking calls /MT link with LIBCMT.LIB
/Gh enable hook function call /MDd link with MSVCRTD.LIB debug lib
/GR[-] enable C++ RTTI /MLd link with LIBCD.LIB debug lib
(press <return> to continue)
/GX[-] enable C++ EH (same as /EHsc) /MTd link with LIBCMTD.LIB debug lib
 Top of the page
Karpour Page Icon Posted 2021-04-09 11:31 AM
#
Avatar image of Karpour
Subscribers
H/PC Philosopher

Posts:
439
Location:
Austria
Status:
cl.exe might work, but there's all these steps in the build process that are done by eVC++ (auto-generating header files, resource files, etc) that would have to be replicated so things properly work.
Might be something to look into at some point, but right now I'm mostly trying to find a setup that works

If there's anyone with more knowledge about eVC++ who wants to work on putting something a little more advanced together, I'm up for it!
 Top of the page
can't remember Page Icon Posted 2021-05-23 1:43 AM
#
Avatar image of can't remember
Factorite (Junior)

Posts:
39
Status:
Quote
Karpour - 2021-04-09 6:43 PM

If anyone has ideas on how I could build from CLI, suggestions are welcome.


Since you have already been experimenting with remote compilation and SSH, if you don't mind running a Linux box this GCC build can compile for Windows CE (I've been using it successfully for some simple command line software). You can also install VS Code on the same Linux box and avoid the remote connection. Last year I tried compiling it on Windows with Mingw-w64 but I didn't succeed, someone with more knowledge of the internals of GCC may be able to figure out how to make that work.
 Top of the page
Karpour Page Icon Posted 2021-05-23 8:24 PM
#
Avatar image of Karpour
Subscribers
H/PC Philosopher

Posts:
439
Location:
Austria
Status:
oh wow, that's super useful, thanks!
I only have a really old build of CEGCC that only runs on 15 year old Linux

Gonna give this a try soon!
 Top of the page
cgallaty Page Icon Posted 2021-10-15 3:12 PM
#
Avatar image of cgallaty
Factorite (Junior)

Posts:
35
Location:
United States
Status:
I was recently looking into what the overhead would be to trying and get some of the older build tool chain and the like into Wine on Linux as a way to contain the mess. Half the overhead is just identifying which bits are not irreplaceable and need to be extracted. There is no way to redistribute the bits, but you could, in theory just make a tool that would extract the needed bits from older tool install packages. I was looking at the Windows 7 driver kit and its the Rich Text box on the EULA that chokes running the install on Wine proper.

Perhaps we need to start a collection of recipes for dev environments.
 Top of the page
watamario15 Page Icon Posted 2022-04-05 4:02 AM
#
Avatar image of watamario15
Factorite (Senior)

Posts:
84
Location:
Japan
Status:
I use this settings for writing Windows CE software on VSCode. "CeGCC" and "eVC4" in the c_cpp_properties.json are for Windows CE IntelliSense, and "[Current C++ File] CeGCC" in the tasks.json is for building Windows CE (SHARP Brain) apps. (I seldom use this task since I often need resource files and have a distinct build script, tho)

includePath and compilerPath should be modified to match the SDK you use. My settings for eVC4 are applicable only when you manually copy "STANDARDSDK_500" which doesn't work on Windows 10/11. I just wanted VSCode to produce CE5 IntelliSense.

It seems some of you had trouble making eVC4 work on Windows 10, but you can use eVC4 SP3 with STANDARDSDK on Windows 10/11. You just have to set the Windows XP SP3 compatible mode to install an SDK. The emulator doesn't work, but the IDE and compilers do.

Edited by watamario15 2022-04-05 4:59 AM




(evc4-on-win11.png)



Attachments
----------------
Attachments evc4-on-win11.png (49KB - 0 downloads)
 Top of the page
Jump to forum:
Seconds to generate: 0.285 - Cached queries : 70 - Executed queries : 12