Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

picolibc: add support for picolibc >= 1.8 #19341

Merged
merged 3 commits into from Mar 5, 2023

Conversation

keith-packard
Copy link
Contributor

@keith-packard keith-packard commented Mar 3, 2023

Contribution description

Minor updates to picolibc support for newer versions of picolibc, including 1.8.

Testing procedure

Here's the current build result for a board I happen to have on my bench right now:

$ make -C examples/blinky BOARD=nucleo-f103rb FEATURES_REQUIRED=picolibc
...
/home/keithp/src/RIOT/sys/picolibc_syscalls_default/syscalls.c:319:1: error: unknown type name '_READ_WRITE_RETURN_TYPE'
  319 | _READ_WRITE_RETURN_TYPE read(int fd, void *dest, size_t count)
      | ^~~~~~~~~~~~~~~~~~~~~~~
/home/keithp/src/RIOT/sys/picolibc_syscalls_default/syscalls.c:351:1: error: unknown type name '_READ_WRITE_RETURN_TYPE'
  351 | _READ_WRITE_RETURN_TYPE write(int fd, const void *src, size_t count)
      | ^~~~~~~~~~~~~~~~~~~~~~~
...

Description of changes

  1. Fix the read/write return values (Picolibc 1.8 uses POSIX standard types now)
  2. Add new symbols to linker scripts (Picolibc needs help dealing with TLS alignment)
  3. Align stack and thread local storage block during thread setup.

Newer picolibc versions require some additional symbols defined in the
linker script to correctly manage alignment constraints on thread
local storage.

Signed-off-by: Keith Packard <keithp@keithp.com>
@github-actions github-actions bot added Area: cpu Area: CPU/MCU ports Area: sys Area: System Platform: ARM Platform: This PR/issue effects ARM-based platforms Platform: RISC-V Platform: This PR/issue effects RISC-V-based platforms labels Mar 3, 2023
Copy link
Contributor

@benpicco benpicco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for keeping this up to date 😃

@benpicco benpicco added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Mar 3, 2023
@riot-ci
Copy link

riot-ci commented Mar 3, 2023

Murdock results

✔️ PASSED

0ceb080 core/thread: Fix up stack and TLS alignments

Success Failures Total Runtime
6919 0 6919 13m:37s

Artifacts

@keith-packard keith-packard force-pushed the picolibc-updates branch 2 times, most recently from 2405eff to cf1bd64 Compare March 3, 2023 16:17
@benpicco
Copy link
Contributor

benpicco commented Mar 3, 2023

bors merge

bors bot added a commit that referenced this pull request Mar 3, 2023
19341: Picolibc updates r=benpicco a=keith-packard

### Contribution description

Minor updates to picolibc support for newer versions of picolibc, including 1.8.


### Testing procedure

Here's the current build result for a board I happen to have on my bench right now:

```
$ make -C examples/blinky BOARD=nucleo-f103rb FEATURES_REQUIRED=picolibc
...
/home/keithp/src/RIOT/sys/picolibc_syscalls_default/syscalls.c:319:1: error: unknown type name '_READ_WRITE_RETURN_TYPE'
  319 | _READ_WRITE_RETURN_TYPE read(int fd, void *dest, size_t count)
      | ^~~~~~~~~~~~~~~~~~~~~~~
/home/keithp/src/RIOT/sys/picolibc_syscalls_default/syscalls.c:351:1: error: unknown type name '_READ_WRITE_RETURN_TYPE'
  351 | _READ_WRITE_RETURN_TYPE write(int fd, const void *src, size_t count)
      | ^~~~~~~~~~~~~~~~~~~~~~~
...
```

### Description of changes

 1. Fix the read/write return values (Picolibc 1.8 uses POSIX standard types now)
 2. Add new symbols to linker scripts (Picolibc needs help dealing with TLS alignment)
 3. Insert carriage return when sending newline to console.


19344: test/periph_rtc: reset struct tm time between tests r=benpicco a=kfessel

### Contribution description

while reviewing #19340 i found test/periph_rtc to be insufficient to prove rtc_set_time is working. this changes that and avoids accidental reuse of struct tm time and ms  values by resetting time and ms;

### Testing procedure

run the test

### Issues/PRs references

#19340

Co-authored-by: Keith Packard <keithp@keithp.com>
Co-authored-by: Karl Fessel <karl.fessel@ovgu.de>
Picolibc switched to standard posix types for read/write return in
version 1.8.

Signed-off-by: Keith Packard <keithp@keithp.com>
@bors
Copy link
Contributor

bors bot commented Mar 3, 2023

Canceled.

Make sure both the stack and TLS blocks are correctly aligned by
adjusting the TLS base address to the most strict alignment of the TLS
block and the stack.

Signed-off-by: Keith Packard <keithp@keithp.com>
@github-actions github-actions bot added the Area: core Area: RIOT kernel. Handle PRs marked with this with care! label Mar 4, 2023
Copy link
Contributor

@benpicco benpicco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bors merge

core/thread.c Show resolved Hide resolved
@benpicco benpicco removed the Area: core Area: RIOT kernel. Handle PRs marked with this with care! label Mar 4, 2023
@bors
Copy link
Contributor

bors bot commented Mar 5, 2023

Build succeeded:

@bors bors bot merged commit a9310ed into RIOT-OS:master Mar 5, 2023
@benpicco benpicco changed the title Picolibc updates picolibc: add support for picolibc >= 1.8 Mar 5, 2023
@MrKevinWeiss MrKevinWeiss added this to the Release 2023.04 milestone Apr 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: cpu Area: CPU/MCU ports Area: sys Area: System CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Platform: ARM Platform: This PR/issue effects ARM-based platforms Platform: RISC-V Platform: This PR/issue effects RISC-V-based platforms
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants