Open-CMSIS-Pack / devtools

Open-CMSIS-Pack development tools - C++
Apache License 2.0
74 stars 57 forks source link

[solution and build] issue with default lib ? #267

Closed fred-r closed 2 years ago

fred-r commented 2 years ago

I have a project specified like this:

# yaml-language-server: $schema=https://raw.githubusercontent.com/Open-CMSIS-Pack/devtools/schemas/projmgr/0.9.0/tools/projmgr/schemas/cproject.schema.json

project:
  optimize: size                   # Code optimization: emphasis code size
  debug: on                        # Enable debug symbols
  # add-paths: [.]
  # add-paths: [./targets/B-U585I-IOT02A]

  components:
    - component: STMicroelectronics::Utility:Debug:simple trace&UART
      for-type: [.GCC_UART, .IAR_UART, .AC6_UART]
    - component: STMicroelectronics::Utility:Debug:simple trace&ITM
      for-type: [.GCC_ITM, .IAR_ITM, .AC6_ITM]
    - component: Board Support&B-U585I-IOT02A:Board Resource
    - component: Device:STM32 HAL:Common
    - component: CMSIS:CORE
    - component: Device:STM32 HAL:Cortex
    - component: Device:STM32 HAL:RCC
    - component: Device:STM32 HAL:PWR
    - component: Device:STM32 HAL:GPIO
    - component: STMicroelectronics::Device:Startup
    - component: Device:STM32 HAL:UART
      for-type: [.GCC_UART, .IAR_UART, .AC6_UART]
    - component: Device:STM32 HAL:DMA
      for-type: [.GCC_UART, .IAR_UART, .AC6_UART]

  # this group will be replaced by code generation
  groups:
    - group: Test code
      files:
        - file: ./main.c
        - file: ./test.c
        - file: ./example_status.c
        - file: ./main.h
        - file: ./test.h
        - file: ./example_status.h
          # add-paths: [.]
    - group: Generated code
      files:
        - file: ./targets/B-U585I-IOT02A/stm32_system.c
        - file: ./targets/B-U585I-IOT02A/stm32_usart1.c
        - file: ./targets/B-U585I-IOT02A/stm32_usart1.h
        - file: ./targets/B-U585I-IOT02A/stm32_target.h
        - file: ./targets/B-U585I-IOT02A/stm32u5xx_hal_conf.h
          # add-paths: [./targets/B-U585I-IOT02A]
    - group: GCC_sys
      for-type: [.GCC_ITM, .GCC_UART]
      files:
        - file: ./targets/B-U585I-IOT02A/syscalls.c
        - file: ./targets/B-U585I-IOT02A/sysmem.c

It compiles and links for AC6_UART:

[20/20] Linking C executable C:\Cube\background\embsw_archi_studies\simple_trace\internal\test.AC6_UART+B-U585I-IOT02A_OutDir\test.AC6_UART+B-U585I-IOT02A.axf
cbuild.sh finished successfully!

But the binary does not work. By opening the cprj in Keil uvision, I can see that the Resethandler is executed but I do not jump into main(). If, under uvision I select the microlib then everything works fine (I jump in main() and run the code).

Two things are not clear to me:

  build-types:
    - type: AC6_UART
      compiler: AC6
      misc:
        - C*:
          - -std=c99
        Lib: microlib 

does not work and I am not sure to understand the spec:

build-types:

==> the example is not the syntax I use today.

the spec says: image

jkrech commented 2 years ago

@fred-r I am unable to answer all your questions, however the lib: refers to the librarian command line: armar options archive [ file_list ] Since in your example you are creating an executable only the linker will be called. If you need to add command line options you need to do it there.

     compiler: AC6
      misc:
        - C*:
          - -O1
          - -g
        - Link:
          - --library_type=microlib
fred-r commented 2 years ago

Thanks Joachim,

my bad again, I am so sorry to be so shabby with the YML :-( Thanks a lot for your guidance.

Now, my exe is working. I still need to figure out why microlib is required for this project and not the other ones...