spaceKelan
spaceKelan

Reputation: 187

Adapting Compilation Chain from MPLAB X IDE to VS Code with MPLAB Plugins

My code builds fine in the MPLAB X IDE (v5.454), but for usability I want to use VS Code with the MPLAB extensions.

My requirements include the use of the xc32 compiler v2.40. The example video does not cover the use of a specific compiler. I have that compiler installed, the path is C:/Program Files/Microchip/xc32/v2.40/bin/, but the VS Code IDE cannot find it. I couldn't find documentation on how to add it.

I learned in this stackoverflow reply, that I need to add the info into the task.json.

I am confused on how to add the content of all the nested Makefiles into a tasks.json.

Furthermore, I realized that the nested Makefiles are ignored by VS Code and the MPLAB plugins all together.

It is too much to manually add everything

How should I proceed?

Please find below the compilation output from the MPLAB X IDE.

All compiler related output from MPLAB X IDE

make -f nbproject/Makefile-default.mk SUBPROJECTS= .build-conf
make[1]: Entering directory 'C:/Users/<my user>/<path to my project>/firmware/MY_PROJECT.X'
make  -f nbproject/Makefile-default.mk dist/default/production/MY_PROJECT.X.production.hex
make[2]: Entering directory 'C:/Users/<my user>/<path to my project>/firmware/MY_PROJECT.X'
"C:\Program Files\Microchip\xc32\v2.40\bin\xc32-gcc.exe"    -g -x c -c -mprocessor=ATSAMRH71F20C  -ffunction-sections -fdata-sections -O1 -I"../src/init" -I"../src/config/default/system/dma" -I"../src/config/default" -I"../src/packs/ATSAMRH71F20C_DFP" -I"../src/packs/CMSIS/CMSIS/Core/Include" -I"../src/packs/CMSIS/" -I"../src/third_party/rtos/FreeRTOS/Source/include" -I"../src/third_party/rtos/FreeRTOS/Source/portable/GCC/SAM/CM7" -I"../src/memoryprotection" -I"../src/config/default/peripheral/abcd" -I"../src/packs/ATSAMRH71F20C_DFP/component" -I"../src/config/default/peripheral/rtc" -I"../src/tasks" -I"../src/memoryprotection" -I"../src/realtimeclock" -I"../src/eeprom" -I"../src/config/default/peripheral/mpu" -I"../src/spi" -I"../src/config/default/peripheral/xyz" -I"../src/config/default/peripheral/mnop" -I"../src/config/default/peripheral/supc" -I"../src/rice" -I"../src/config/default/peripheral/qspi" -I"../src/ccc" -I"../src/device" -I"../src/extflash" -Werror -Wall -MP -MMD -MF "build/default/production/_ext/14461671/sys_dma.o.d" -o build/default/production/_ext/14461671/sys_dma.o ../src/config/default/system/dma/sys_dma.c   -mdtcm=0x40000 -mitcm=0x20000 -DXPRJ_default=default      -mdfp="C:/Users/<my user>/.mchp_packs/Microchip/SAMRH71_DFP/2.1.105/samrh71c" -I "C:/Users/<my user>/.mchp_packs/ARM/CMSIS/5.4.0/CMSIS/Core/Include" 
... many more lines like this ...
"C:\Program Files\Microchip\xc32\v2.40\bin\xc32-gcc.exe"    -g -x c -c -mprocessor=ATSAMRH71F20C  -ffunction-sections -fdata-sections -O1 -I"../src/init" -I"../src/config/default/system/dma" -I"../src/config/default" -I"../src/packs/ATSAMRH71F20C_DFP" -I"../src/packs/CMSIS/CMSIS/Core/Include" -I"../src/packs/CMSIS/" -I"../src/third_party/rtos/FreeRTOS/Source/include" -I"../src/third_party/rtos/FreeRTOS/Source/portable/GCC/SAM/CM7" -I"../src/memoryprotection" -I"../src/config/default/peripheral/abcd" -I"../src/packs/ATSAMRH71F20C_DFP/component" -I"../src/config/default/peripheral/rtc" -I"../src/tasks" -I"../src/memoryprotection" -I"../src/realtimeclock" -I"../src/eeprom" -I"../src/config/default/peripheral/mpu" -I"../src/spi" -I"../src/config/default/peripheral/xyz" -I"../src/config/default/peripheral/mnop" -I"../src/config/default/peripheral/supc" -I"../src/rice" -I"../src/config/default/peripheral/qspi" -I"../src/ccc" -I"../src/device" -I"../src/extflash" -Werror -Wall -MP -MMD -MF "build/default/production/_ext/404212886/FreeRTOS_tasks.o.d" -o build/default/production/_ext/404212886/FreeRTOS_tasks.o ../src/third_party/rtos/FreeRTOS/Source/FreeRTOS_tasks.c   -mdtcm=0x40000 -mitcm=0x20000 -DXPRJ_default=default      -mdfp="C:/Users/<my user>/.mchp_packs/Microchip/SAMRH71_DFP/2.1.105/samrh71c" -I "C:/Users/<my user>/.mchp_packs/ARM/CMSIS/5.4.0/CMSIS/Core/Include" 
"C:\Program Files\Microchip\xc32\v2.40\bin\xc32-gcc.exe"    -g -x c -c -mprocessor=ATSAMRH71F20C  -ffunction-sections -fdata-sections -O1 -I"../src/init" -I"../src/config/default/system/dma" -I"../src/config/default" -I"../src/packs/ATSAMRH71F20C_DFP" -I"../src/packs/CMSIS/CMSIS/Core/Include" -I"../src/packs/CMSIS/" -I"../src/third_party/rtos/FreeRTOS/Source/include" -I"../src/third_party/rtos/FreeRTOS/Source/portable/GCC/SAM/CM7" -I"../src/memoryprotection" -I"../src/config/default/peripheral/abcd" -I"../src/packs/ATSAMRH71F20C_DFP/component" -I"../src/config/default/peripheral/rtc" -I"../src/tasks" -I"../src/memoryprotection" -I"../src/realtimeclock" -I"../src/eeprom" -I"../src/config/default/peripheral/mpu" -I"../src/spi" -I"../src/config/default/peripheral/xyz" -I"../src/config/default/peripheral/mnop" -I"../src/config/default/peripheral/supc" -I"../src/rice" -I"../src/config/default/peripheral/qspi" -I"../src/ccc" -I"../src/device" -I"../src/extflash" -Werror -Wall -MP -MMD -MF "build/default/production/_ext/1360937237/main.o.d" -o build/default/production/_ext/1360937237/main.o ../src/main.c   -mdtcm=0x40000 -mitcm=0x20000 -DXPRJ_default=default      -mdfp="C:/Users/<my user>/.mchp_packs/Microchip/SAMRH71_DFP/2.1.105/samrh71c" -I "C:/Users/<my user>/.mchp_packs/ARM/CMSIS/5.4.0/CMSIS/Core/Include" 
"C:\Program Files\Microchip\xc32\v2.40\bin\xc32-gcc.exe"   -mprocessor=ATSAMRH71F20C -mno-device-startup-code -o dist/default/production/MY_PROJECT.X.production.elf build/default/production/_ext/14461671/sys_dma.o <path to other objectfile/object.o> build/default/production/_ext/404212886/FreeRTOS_tasks.o build/default/production/_ext/1360937237/main.o         -mdtcm=0x40000 -mitcm=0x20000 -DXPRJ_default=default      -Wl,--defsym=__MPLAB_BUILD=1,--script="ATSAMRH71F20C.ld",--defsym=_min_heap_size=512,--defsym=_min_stack_size=10240,--gc-sections,-Map="dist/default/production/MY_PROJECT.X.production.map",--report-mem,--memorysummary,dist/default/production/memoryfile.xml,-T,C:/Users/<my user>/< path to project folder>/firmware/MY_PROJECT.X/ATSAMRH71F20C.ld -mdfp="C:/Users/<my user>/.mchp_packs/Microchip/SAMRH71_DFP/2.1.105/samrh71c"
...
BUILD SUCCESSFUL (total time: 22s)
...

It seems that the numbers in the build/default/production/_ext/<number order a>/<object file a>.o change with every build.

I am new to how to configure such a complex project compilation and do bring a limited computer science background.

Upvotes: 2

Views: 59

Answers (1)

Mike
Mike

Reputation: 4288

At the moment it is very difficult to get a Microchip project running with Visual Studio and MPLAB extension.

These extensions are currently released under an early access program, which will allow users to try them out and provide Microchip with community feedback. Your recommendations will help to refine the extensions to better suit your development needs. They want your feedback to build a new IDE based on Visual Studio.

If you have a current project and don't just want to play, better use MPLABX 6.2.

There is also a Feedback Form on the microchip website about your experience with the MPLAB extensions.

Upvotes: 1

Related Questions