Compilation of RT-Win32-Simulator demo with Visual Studio

This forum is dedicated to feedback, discussions about ongoing or future developments, ideas and suggestions regarding the ChibiOS projects are welcome. This forum is NOT for support.
Post Reply
dismirlian
Posts: 65
Joined: Fri Dec 20, 2013 3:59 pm
Has thanked: 1 time
Been thanked: 16 times

Compilation of RT-Win32-Simulator demo with Visual Studio

Post by dismirlian »

Hi all, I attach a patch for the stable_20.3.x branch, with minor modifications:

- Adapt some sources to be able to compile with MSVC
- Add a Visual Studio project to the RT-Win32-Simulator demo (demos/various/RT-Win32-Simulator/visual-studio).

This enables compilation with Visual Studio (which is a great IDE, btw). Tested with Visual Studio Community Edition 2019.

Thanks!
Diego.
Attachments
enable_compilation_of_win32_simulator_with_visual_studio.zip
(8.93 KiB) Downloaded 522 times
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Compilation of RT-Win32-Simulator demo with Visual Studio

Post by Giovanni »

Hi,

Few problems:

1) Cannot put MSVC code in files under compilers/GCC, you need to split the directories, create a compilers/MSVC.

2) Do not make conditional changes that would also work with GCC. In general minimize conditionals.

3) XML based projects are going to break as soon there is a change in files structure. If possible use makefiles.

Giovanni
dismirlian
Posts: 65
Joined: Fri Dec 20, 2013 3:59 pm
Has thanked: 1 time
Been thanked: 16 times

Re: Compilation of RT-Win32-Simulator demo with Visual Studio

Post by dismirlian »

Hi Giovanni,

1) There are no new files under compilers/GCC, I effectively created compilers/MSVC; where do you see this problem?

2) Ok, I'll try to fix/minimize those.

3) I don't know any way of using makefiles with VS, keeping the Intellisense/IDE tools working well. Do you know how to do this?

Thanks,
Diego.
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Compilation of RT-Win32-Simulator demo with Visual Studio

Post by Giovanni »

1) I looked at the patch, perhaps I am wrong.

2) OK.

3) No idea, I don't use it, this is why it would break unless it is maintained.

Giovanni
dismirlian
Posts: 65
Joined: Fri Dec 20, 2013 3:59 pm
Has thanked: 1 time
Been thanked: 16 times

Re: Compilation of RT-Win32-Simulator demo with Visual Studio

Post by dismirlian »

Hi Giovanni,

2) New patch attached.

3) IMHO there is no inherent benefit in compiling with MSVC instead of GCC. The only reason I wanted this is because Visual Studio is really great for development, especially for developing the application logic, and Visual Studio handles MSVC very "naturally". I know that the XML project is not great... Even if you don't merge it, maybe someone finds this useful.

Thanks!
Diego.
Attachments
enable_compilation_of_win32_simulator_with_visual_studio.zip
(9.11 KiB) Downloaded 483 times
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Compilation of RT-Win32-Simulator demo with Visual Studio

Post by Giovanni »

Hi,

Please don't misunderstand me, it is welcome, note that when I FIST ran ChibiOS it was in what then become the "Win32 simulator", it was in 2006 and I used Visual Studio.... then ported it to ARM.

Code compatibility is good, the only problem I can see is that the project is going to break like it happens (a lot) with Keil and IAR projects. Rebuild those after tree changes is a PITA.

Giovanni
dismirlian
Posts: 65
Joined: Fri Dec 20, 2013 3:59 pm
Has thanked: 1 time
Been thanked: 16 times

Re: Compilation of RT-Win32-Simulator demo with Visual Studio

Post by dismirlian »

Hi Giovanni, no problem, I know you welcome contributions!

What I meant is:
- The changes in os/... should not have a high maintenance impact; it only allows MSVC to compile the code.
- The project itself (under demos/), which may have maintenance impact, could go as a .zip in the forum or in the ChibiOS-Contrib repository.

What do you think?

Diego.
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Compilation of RT-Win32-Simulator demo with Visual Studio

Post by Giovanni »

It is OK, I can also include the project knowing it may break.

Giovanni
dismirlian
Posts: 65
Joined: Fri Dec 20, 2013 3:59 pm
Has thanked: 1 time
Been thanked: 16 times

Re: Compilation of RT-Win32-Simulator demo with Visual Studio

Post by dismirlian »

Hi Giovanni,

I split the patch in two:
1. enable_compilation_with_msvc: fixes compilation with MSVC for IA32 architecture.
2. rt_win32_simulator_visual_studio_project: Visual Studio project for the RT-Win32-Simulator demo project.

Thanks!
Diego.
Attachments
rt_win32_simulator_visual_studio_project.zip
(6.13 KiB) Downloaded 521 times
enable_compilation_with_msvc.zip
(3.1 KiB) Downloaded 514 times
Post Reply