Skip to content

Build_opt.h only used when compiled with LTO #2698

@bbc25185

Description

@bbc25185

Describe the bug
After testing, I noticed that the Build_opt.h file is used only if, as a compilation optimization, one with LTO is chosen.

To Reproduce
The Build_opt.h file contains the following code:
-DSERIAL_RX_BUFFER_SIZE=512 -DSERIAL_TX_BUFFER_SIZE=512
-DMAVLINK_COMM_NUM_BUFFERS=4
-DPIN_SERIAL1_RX=PB7 -DPIN_SERIAL1_TX=PB6
-DENABLE_HWSERIAL1
-DPIN_SERIAL2_RX=PA3 -DPIN_SERIAL2_TX=PA2
-DENABLE_HWSERIAL2
-DPIN_SERIAL3_RX=PB9 -DPIN_SERIAL3_TX=PB8
-DENABLE_HWSERIAL3
-DPIN_SERIAL4_RX=PA1 -DPIN_SERIAL4_TX=PA0
-DENABLE_HWSERIAL4

Steps to reproduce the behavior:
Selected Board: STM32G0 Series
Board Part Number: Generic G070KBTx
Usart Support: Enabled (No generic Serial)
Compiled with Optimize - Smallest: No error and Ram usage dont change with Buffer size change
Compiled with Optimize - Smallest with LTO: Various error reporting "note: 'SerialX' was previously declared here" and Buffer Size changing with Buffer Size setting.

Expected behavior
The file Build_opt.h always working

Desktop (please complete the following information):

  • Windows11
  • Arduino IDE version: 2.3.4
  • STM32 core version: 2.10.1
  • Tools menu settings if not the default: Usart Support: Enabled (no generic Serial)
  • Upload method: SWD

Board (please complete the following information):

  • Name: STM32G0 Series
  • Hardware Revision: Generic G070KBTx

Additional context
To solve the problem, I normally compiled with LTO but due to errors that appeared when I started implementing FreeRtos.
Without LTO the options in the Build_opt.h file are not applied for my project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions