-
Notifications
You must be signed in to change notification settings - Fork 2.1k
cpu/samd21: i2c timing with compiler optimization #5460
Copy link
Copy link
Closed
Labels
Area: driversArea: Device driversArea: Device driversDiscussion: RFCThe issue/PR is used as a discussion starting point about the item of the issue/PRThe issue/PR is used as a discussion starting point about the item of the issue/PRState: archivedState: The PR has been archived for possible future re-adaptationState: The PR has been archived for possible future re-adaptationType: bugThe issue reports a bug / The PR fixes a bug (including spelling errors)The issue reports a bug / The PR fixes a bug (including spelling errors)
Milestone
Description
The i2c driver for samd21 CPUs has timing problems with the standard compiler optimization -Os. The optimization level for this CPU was enabled in #2848. It seems that e.g. this code line is not executed which may lead to collisions on the bus. In my case I got stuck using tests/drivers_tmp006 with an Atmel samr21-xpro and an external tmp006 sensor. As a bugfix I see two alternatives (for now):
- Disable size optimisation for samd21 again by reverting cpu/samd21: set optimization level to -Os #2848
- PRO: Who knows where else it introduced failures?
- CON: Huge code sizes
text data bss dec hex filename
15516 128 2792 18436 4804 ...samr21-xpro/driver_tmp006.elf
- Stay with
-Osand useputs()instead ofDEBUG()at critical parts (as shown above)
- PRO: Smaller code sizes; Does not hurt in this case; Improves current situation
- CON: Seems a bit like a random solution; Probably compiler dependant?; Similar bugs in other drivers possible
text data bss dec hex filename
10236 128 2792 13156 3364 ...samr21-xpro/driver_tmp006.elf
BTW: I used gcc version 5.2.1 20151202 (release) [ARM/embedded-5-branch revision 231848]
What's your opinion?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Area: driversArea: Device driversArea: Device driversDiscussion: RFCThe issue/PR is used as a discussion starting point about the item of the issue/PRThe issue/PR is used as a discussion starting point about the item of the issue/PRState: archivedState: The PR has been archived for possible future re-adaptationState: The PR has been archived for possible future re-adaptationType: bugThe issue reports a bug / The PR fixes a bug (including spelling errors)The issue reports a bug / The PR fixes a bug (including spelling errors)