littlekernel / lk

LK embedded kernel

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

newlib - unknown type name 'clock_t'

Inchul-Lee opened this issue · comments

I am using little-kernel with newlib or newlib-nano for using the time functions. But I am facing with error as the following.
image
Is it a issue or my mistake?

LK doesn't define clock_t anywhere inside the tree, but it has it's own notion of time that may sync up with clock_t.

See lk_time_t or lk_bigtime_t. It may be that what newlib is expecting clock_t to be would line up with that, and you could locally typedef clock_t as lk_time_t

Thank you for your relpy. Actaully I need functions like as localtime() ans so on. How can I use this functions? For your reference I attached a part of my code.
image

You'll have to implement it, since LK has no concept of localtime() and doesn't track any sort of notion of time zones or time of day. It shouldn't be too difficult to implement, but there will have to be some notion of synchronizing time with an RTC and then tracking localtime.

OK, So I am trying to apply newlib for mktime() and localtime() functions. If you have a idea to apply newlib into little-kernel, please give me some information.

I have decided to implement the function for time according to your guide.
Thank you.

Yah, I've thought about newlib from time to time. The general issue is for everyone that wants to use newlib, someone wants to use another libc, so in general LK doesn't take a stance on it. However, it does mean these sort of things show up and there's not a good single solution except to try to support all of the libcs and have a compile time switch. I think it'd be technically doable, but it'd be a huge amount of work.

Happy to see someone using LK! Is this for a personal project or something else?

Hi, This is my company's project. I think that the newlib is good solution. But the flash size of my producut is limited. If I use newlib, I assume that the flash memory size is not enough. Thank you for your attention.