bugAVR C Runtime Library - Bugs: bug #57299, util/setbaud.h incompatible with...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #57299: util/setbaud.h incompatible with new AVR iom*.h headers

Submitter:  Matt Wette <mwette>
Submitted:  Mon 25 Nov 2019 06:10:21 PM UTC
   
 
Category:  Header Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Header files
Status:  None Assigned to:  None
Percent Complete:  0% Open/Closed:  Open
Release:  2.0.0 Fixed Release:  None

Mon 25 Nov 2019 09:03:48 PM UTC, comment #2: 

My proposed workaround is not correct because one still needs to compute the baud rate with respect to the F_CPU, so we still need a way to compute the register value.

Matt Wette <mwette>
Mon 25 Nov 2019 07:06:30 PM UTC, comment #1: 

Well, it's really a poor idea from the to use such a common name like BAUD for a subregister. I wonder how much code needs to be reworked now ...

Sure, we could work around that by calling it BAUDRATE, and make BAUD an alias for it on controllers where it does not conflict.

Joerg Wunsch <joerg_wunsch>
Group administrator
Mon 25 Nov 2019 06:10:21 PM UTC, original submission:  

Newer headers povided in the device packs from microchip include a struct for UARTS that defines a member "BAUD".   This conflicts with the use of command line argument "-DBAUD-9600U".   Use of this command line argument to avr-gcc results in compile error:

/opt/local/bin/avr-gcc -mmcu=atmega4809 -DF_CPU=3333333UL -Os -I.. -I../../ -B/opt/local/avr/packs/mega-1.3.300 -DBAUD=9600UL -c main.c -o main.o
In file included from /opt/local/avr/include/avr/io.h:578,
                 from main.c:3:
<command-line>: error: expected identifier or '(' before numeric constant

A solution is to not include util/setbaud.h and instead use command line argument -DBAUDRATE=9600UL with the following usage:

USART0.BAUD = BAUDRATE;

There is a workable solution but the problem of running into the obscure error message will persist.  Maybe replacing BAUD with some other convention will help.

Matt Wette <mwette>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by joerg_wunsch (Posted a comment)
  • -email is unavailable- added by mwette (Submitted the item)
  •  

    No changes have been made to this item

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code