eclipse-plugins icon indicating copy to clipboard operation
eclipse-plugins copied to clipboard

Improper build support for multi-target ARM + Risc-V project

Open nvitya opened this issue 4 years ago • 13 comments

Description

Hi,

I've created a project with multiple build configurations. The project was originally created with Risc-V target, and then I've added a build configuration with ARM (Cortex-M). The build configuration for ARM is not fully supported. At the Project properties / "C/C++ Build" / "Settings" / "Toolchains" tab is a limited version is displayed without "Create Flash Image" and "Print Size" checkboxes.

The build basically works for the ARM, but without creating HEX file or printing the size of the compiled project.

If you create a new project with ARM first then the ARM is fully supported and the Risc-V build will be somewhat limited.

Steps to Reproduce

  1. Create a C/C++ Managed Project with "Risc-V Cross GCC"
  2. Add a new build configuration "ARM TEST", and set the toolchain to "Arm Cross GCC"
  3. Select the "ARM TEST" build configuration, and go to the Project properties / "C/C++ Build" / "Settings" / "Toolchains" tab

Expected behaviour: there should be the "Create Flash Image" and "Print Size" checkboxes.

Actual behaviour: they are not there...

Versions

  • [plug-in version] 6.1.2.202102181132
  • [Eclipse version] 19-06, 21-09 (4.21)
  • [Java version] OpenJDK Runtime Environment (build 11.0.11+9-Ubuntu-0ubuntu2.20.04)
  • [operating system] KUbuntu 20.04
  • [toolchain version]

nvitya avatar Oct 24 '21 10:10 nvitya

I confirm the bug.

ilg-ul avatar Oct 24 '21 12:10 ilg-ul

The problem was related to the logic that identifies own managed build plug-ins by the ids, which use both ilg.gnuarmeclipse and ilg.gnumcueclipse.

Fixed on 2021-10-24.

ilg-ul avatar Oct 24 '21 15:10 ilg-ul

Please use Install new Software to install the 6.2.0 pre-release from:

  • https://download.eclipse.org/embed-cdt/builds/develop/p2/

and let me know if it is ok.

ilg-ul avatar Oct 24 '21 17:10 ilg-ul

I've installed the pre-release. Now the "Toolchains" tabs looks the same, but still no HEX file generation and size report is done, however the checkboxes are active. Even if I toggled them. I've also created a new project from zero to test it properly, without success (still no HEX + size report for the secondary architecture - after successful compilation and linking).

nvitya avatar Oct 25 '21 18:10 nvitya

Can you double check if you have the 6.2.0 features installed?

Screenshot 2021-10-25 at 22 29 33

The bug affected the logic used to decide what elements should be displayed, and normally should not store anything in the persistent store, so it should help for old projects too.

ilg-ul avatar Oct 25 '21 19:10 ilg-ul

Here it is how it looks on my Mac:

Screenshot 2021-10-25 at 22 25 12

The original build configurations were created for RISC-V:

Screenshot 2021-10-25 at 22 26 56

ilg-ul avatar Oct 25 '21 19:10 ilg-ul

Yes, that's fine, I see these pages already too. But the "Create flash image" and "Print size" does not have an effect on the second created architecture.

nvitya avatar Oct 25 '21 19:10 nvitya

Ah, that's different. So you see the radio buttons, but the functionality associated with them is not there?

ilg-ul avatar Oct 25 '21 19:10 ilg-ul

multiarch_test.zip

Here is a small test project. Risc-V output:

21:39:50 **** Build of configuration RV32I for project multiarch_test ****
make all 
Building file: ../main.c
Invoking: GNU RISC-V Cross C Compiler
riscv-none-embed-gcc -march=rv32i -msmall-data-limit=8 -mno-save-restore -O0 -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -ffreestanding  -g3 -std=gnu11 -MMD -MP -MF"main.d" -MT"main.o" -c -o "main.o" "../main.c"
Finished building: ../main.c
 
Building target: multiarch_test.elf
Invoking: GNU RISC-V Cross C Linker
riscv-none-embed-gcc -march=rv32i -msmall-data-limit=8 -mno-save-restore -O0 -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -ffreestanding  -g3 -nostartfiles -Xlinker --gc-sections -Wl,-Map,"multiarch_test.map" --specs=nano.specs -o "multiarch_test.elf"  ./main.o   
Finished building target: multiarch_test.elf
 
Invoking: GNU RISC-V Cross Create Flash Image
riscv-none-embed-objcopy -O ihex "multiarch_test.elf"  "multiarch_test.hex"
Finished building: multiarch_test.hex
 
Invoking: GNU RISC-V Cross Print Size
riscv-none-embed-size --format=berkeley "multiarch_test.elf"
   text	   data	    bss	    dec	    hex	filename
     32	      0	      0	     32	     20	multiarch_test.elf
Finished building: multiarch_test.siz
 
21:39:50 Build Finished. 0 errors, 0 warnings. (took 161ms)

ARMM compile output:

21:44:04 **** Incremental Build of configuration ARMM for project multiarch_test ****
make all 
Building file: ../main.c
Invoking: GNU Arm Cross C Compiler
arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -O2 -fmessage-length=0 -ffunction-sections -fdata-sections -ffreestanding  -g -std=gnu11 -MMD -MP -MF"main.d" -MT"main.o" -c -o "main.o" "../main.c"
Finished building: ../main.c
 
Building target: multiarch_test.elf
Invoking: GNU Arm Cross C Linker
arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -O2 -fmessage-length=0 -ffunction-sections -fdata-sections -ffreestanding  -g -nostartfiles -Xlinker --gc-sections -Wl,-Map,"multiarch_test.map" --specs=nano.specs -o "multiarch_test.elf"  ./main.o   
Finished building target: multiarch_test.elf
 

21:44:04 Build Finished. 0 errors, 0 warnings. (took 110ms)

nvitya avatar Oct 25 '21 19:10 nvitya

Thank you, that should be helpful.

I don't know yet how difficult to fix is this, I'll further investigate.

ilg-ul avatar Oct 25 '21 19:10 ilg-ul

I successfully imported your project and took a look at the .cproject file. At first sight I could not spot anything wrong, it'll require a more thorough analysis.

The creation of the make files is done in the parent CDT classes, based on the content of .cproject and the toolchain definitions in the plug-ins.

I'll take a second look in a few days, time permitting.

ilg-ul avatar Oct 25 '21 21:10 ilg-ul

I confirm that I encountered this issue myself.

My use case was reversed, I had several Arm build configurations and added a RISC-V configuration. So the problem is not specific to Arm or RISC-V separately, it seems to affect all configurations.

The 3 options related to hex/listing/size did not show in the configuration page, although they were present in the .cproject. However they were functional, the build created those files, and manually editing .cproject changed the behaviour.

@jonahgraham, time permitting, probably we should try to identify why CDT does not display these options, otherwise functional in ECDT.

ilg-ul avatar Jun 11 '22 10:06 ilg-ul

@jonahgraham, please ignore the previous request, I took a more careful look and the missing widgets are not in the tab rendered by CDT, but in a tab rendered by the ECDT plug-ins, so it is a bug in my code.

I'll fix it shortly.

ilg-ul avatar Jun 12 '22 17:06 ilg-ul