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.
dismirlian
Posts: 60
Joined: Fri Dec 20, 2013 3:59 pm
Location: Buenos Aires, Argentina
Has thanked: 1 time
Been thanked: 11 times

Compilation of RT-Win32-Simulator demo with Visual Studio

Postby dismirlian » Sun Jul 05, 2020 5:10 pm

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 8 times

User avatar
Giovanni
Site Admin
Posts: 12945
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 731 times
Been thanked: 609 times
Contact:

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

Postby Giovanni » Sun Jul 05, 2020 5:20 pm

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: 60
Joined: Fri Dec 20, 2013 3:59 pm
Location: Buenos Aires, Argentina
Has thanked: 1 time
Been thanked: 11 times

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

Postby dismirlian » Sun Jul 05, 2020 5:37 pm

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: 12945
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 731 times
Been thanked: 609 times
Contact:

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

Postby Giovanni » Sun Jul 05, 2020 5:44 pm

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: 60
Joined: Fri Dec 20, 2013 3:59 pm
Location: Buenos Aires, Argentina
Has thanked: 1 time
Been thanked: 11 times

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

Postby dismirlian » Sun Jul 05, 2020 8:26 pm

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 7 times

User avatar
Giovanni
Site Admin
Posts: 12945
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 731 times
Been thanked: 609 times
Contact:

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

Postby Giovanni » Sun Jul 05, 2020 9:34 pm

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: 60
Joined: Fri Dec 20, 2013 3:59 pm
Location: Buenos Aires, Argentina
Has thanked: 1 time
Been thanked: 11 times

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

Postby dismirlian » Mon Jul 06, 2020 6:03 pm

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: 12945
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 731 times
Been thanked: 609 times
Contact:

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

Postby Giovanni » Mon Jul 06, 2020 6:33 pm

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

Giovanni

dismirlian
Posts: 60
Joined: Fri Dec 20, 2013 3:59 pm
Location: Buenos Aires, Argentina
Has thanked: 1 time
Been thanked: 11 times

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

Postby dismirlian » Mon Jul 06, 2020 8:17 pm

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 6 times
enable_compilation_with_msvc.zip
(3.1 KiB) Downloaded 6 times


Return to “Development and Feedback”

Who is online

Users browsing this forum: No registered users and 6 guests