While I strongly believe my issue is in my build environment I am able to compile when I change the -mmcu to atmega328p. The atmega32u4 does not have UBBR or UBBR0 it only has UBRR1 and that might be causing the issue. However I do see the 32u4 in the header.
pio run -v
Processing atmega32u4 (platform: atmelavr; board_build.mcu: atmega32u4; board_build.f_cpu: 16000000L; upload_protocol: arduino; upload_speed: 115200; build_unflags: -std=gnu11; build_flags: -std=gnu99)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------HARDWARE: ATMEGA32U4 16MHz,
PACKAGES:
- toolchain-atmelavr 1.70300.191015 (7.3.0)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 4 compatible libraries
More details about "Library Compatibility Mode": https://docs.platformio.org/page/librarymanager/ldf.html#ldf-compat-mode
Scanning dependencies...
Dependency Graph
|-- <usart> (D:\Documents\OneDrive\Documents\PlatformIO\Projects\delme\lib\usart)
Building in release mode
avr-gcc -o .pio\build\atmega32u4\src\main.o -c -fno-fat-lto-objects -std=gnu99 -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=atmega32u4 -DF_CPU=16000000L -DPLATFORMIO=50101 -Iinclude -Isrc -Ilib\usart src\main.c
avr-gcc -o .pio\build\atmega32u4\libbd1\usart\usart.o -c -fno-fat-lto-objects -std=gnu99 -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=atmega32u4 -DF_CPU=16000000L -DPLATFORMIO=50101 -Ilib\usart lib\usart\usart.c
In file included from src\main.c:8:0:
lib\usart/usart.h:1439:7: warning: always_inline function might not be inlinable [-Wattributes]
void uart1_hardware_flow_control_init(uint8_t ctsenable, uint8_t rtsenable) // pass true to enable
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from lib\usart\usart.c:18:0:
lib\usart\usart.h:1439:7: warning: always_inline function might not be inlinable [-Wattributes]
void uart1_hardware_flow_control_init(uint8_t ctsenable, uint8_t rtsenable) // pass true to enable
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
avr-gcc-ar rc .pio\build\atmega32u4\libbd1\libusart.a .pio\build\atmega32u4\libbd1\usart\usart.o
avr-gcc -o .pio\build\atmega32u4\firmware.elf -Os -mmcu=atmega32u4 -Wl,--gc-sections -flto -fuse-linker-plugin .pio\build\atmega32u4\src\main.o -L.pio\build\atmega32u4 -Wl,--start-group .pio\build\atmega32u4\libbd1\libusart.a -lm -Wl,--end-group
usart.o (symbol from plugin): In function `uart1_hardware_flow_control_init':
(.text+0x0): multiple definition of `uart1_hardware_flow_control_init'
.pio\build\atmega32u4\src\main.o (symbol from plugin):(.text+0x0): first defined here
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\atmega32u4\firmware.elf] Error 1
================================================================================================== [FAILED] Took 1.66 seconds ==================================================================================================
While I strongly believe my issue is in my build environment I am able to compile when I change the -mmcu to atmega328p. The atmega32u4 does not have UBBR or UBBR0 it only has UBRR1 and that might be causing the issue. However I do see the 32u4 in the header.
and the main.c file