Skip to content

Commit

Permalink
Fix IFS build inconsistencies (#2774)
Browse files Browse the repository at this point in the history
This PR addresses a couple of issues which have arisen in testing.

**Globally define _POSIX_C_SOURCE**

Value set by Sming to 200809L making available functionality from the 2008 edition of the POSIX standard (IEEE Standard 1003.1-2008). See https://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html.

We should expect those features to be available generally.
IFS library no longer needs to define this.

**Fix IFS issues**

- Fix README links
- Build images using environment variables with regular Windows paths require 'fixing', e.g. "/C/dir/path" -> "C:/dir/path"

- Remove `TimeStamp::String()` operator completely: it's ambiguous

TimeStamp has implicit `time_t` cast, which is appropriate.
Calling `String(timestamp)` could yield the numeric value or the string value. Instead, call `toString()` method.

For example, when calling `Serial.println(timestamp);` GCC 10.2 calls `TimeStamp::String()`, whereas GCC 14.1 uses `String(time_t)`.
  • Loading branch information
mikee47 authored May 27, 2024
1 parent ef3cc6b commit 7d69a58
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
4 changes: 0 additions & 4 deletions Sming/Arch/Host/Components/hostlib/include/hostlib/hostlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@

#pragma once

// Required for sleep(), probably others
#undef _POSIX_C_SOURCE
#define _POSIX_C_SOURCE 200112L

#ifdef __WIN32
// Prevent early inclusion of winsock.h
#include <winsock2.h>
Expand Down
3 changes: 2 additions & 1 deletion Sming/build.mk
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ CPPFLAGS = \
-Wl,-EL \
-finline-functions \
-fdata-sections \
-ffunction-sections
-ffunction-sections \
-D_POSIX_C_SOURCE=200809L

# Required to access peripheral registers using structs
# e.g. `uint32_t value: 8` sitting at a byte or word boundary will be 'optimised' to
Expand Down

0 comments on commit 7d69a58

Please sign in to comment.