Skip to content

Commit

Permalink
The gcc in IDF 5.1 appears to have fixed the attribute bug affecting …
Browse files Browse the repository at this point in the history
…IRAM_ATTR.
  • Loading branch information
dok-net committed Jul 2, 2023
1 parent 7a14d3e commit f744768
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/SoftwareSerial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,7 @@ void UARTBase::onReceive(Delegate<void(), void*>&& handler) {
restoreInterrupts();
}

#if __GNUC__ < 12
// The template member functions below must be in IRAM, but due to a bug GCC doesn't currently
// honor the attribute. Instead, it is possible to do explicit specialization and adorn
// these with the IRAM attribute:
Expand All @@ -616,4 +617,5 @@ template void IRAM_ATTR delegate::detail::DelegateImpl<void*, void>::operator()(
template size_t IRAM_ATTR circular_queue<uint32_t, UARTBase*>::available() const;
template bool IRAM_ATTR circular_queue<uint32_t, UARTBase*>::push(uint32_t&&);
template bool IRAM_ATTR circular_queue<uint32_t, UARTBase*>::push(const uint32_t&);
#endif // __GNUC__ < 12

2 changes: 2 additions & 0 deletions src/SoftwareSerial.h
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,7 @@ using UART = BasicUART< GpioCapabilities >;
using SoftwareSerial = EspSoftwareSerial::UART;
using namespace EspSoftwareSerial;

#if __GNUC__ < 12
// The template member functions below must be in IRAM, but due to a bug GCC doesn't currently
// honor the attribute. Instead, it is possible to do explicit specialization and adorn
// these with the IRAM attribute:
Expand All @@ -442,6 +443,7 @@ extern template void delegate::detail::DelegateImpl<void*, void>::operator()() c
extern template size_t circular_queue<uint32_t, EspSoftwareSerial::UARTBase*>::available() const;
extern template bool circular_queue<uint32_t, EspSoftwareSerial::UARTBase*>::push(uint32_t&&);
extern template bool circular_queue<uint32_t, EspSoftwareSerial::UARTBase*>::push(const uint32_t&);
#endif // __GNUC__ < 12

#endif // __SoftwareSerial_h

0 comments on commit f744768

Please sign in to comment.