std::chrono: g++ 12.4 vs 13+ on bare metal

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi gcc,
i used until recent gcc 12.4 on a STM32F103RBT6 MCU. There i can
include <chrono>.

The follwing work here:
#include <chrono>

namespace STM32F103
{
struct SysTickClock
{
	typedef std::chrono::duration<int64_t,
std::ratio<1,SysTickDriver::IncPerSecond>> duration;
	typedef duration::rep rep;
	typedef duration::period period;
	typedef std::chrono::time_point<SysTickClock> time_point;

	static const bool is_steady = true;

	static time_point now() noexcept;
};
static_assert(std::chrono::is_clock_v<SysTickClock>);

With 13+ i get this error:
In file included from /opt/arm-none-eabi/13.3/arm-none-
eabi/include/c++/13.3.0/chrono:35,
                 from
/home/georg/Dokumente/Entwicklung/01_Projects/EmbeddedCMake/src/RT/STM3
2F103/include/Hardware/Clock.h:3,
                 from
/home/georg/Dokumente/Entwicklung/01_Projects/EmbeddedCMake/src/RT/STM3
2F103/Clock.cpp:1:
/opt/arm-none-eabi/13.3/arm-none-
eabi/include/c++/13.3.0/bits/requires_hosted.h:34:4: error: #error
"This header is not available in freestanding mode."
   34 | #  error "This header is not available in freestanding mode."

In my case i use a chrono clock to get a steady clock from the systick
and the systick value register. I set the ratio depending on the
frequency that triggers the systick.

Is this an intended change on g++ (or better libstd++), a bug or what
else?

The compiler got compiled with the log in my post
"Build Gcc 14.2 for arm-none-eabi: Gcc git or source from ARM
developer?"

Bye

Georg






[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux