Skip to content

Commit

Permalink
[mlibc] support mlibc for rt-smart
Browse files Browse the repository at this point in the history
  • Loading branch information
0Bitbiscuits committed Jan 20, 2025
1 parent 2c4fb34 commit f067dbb
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/action_utest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ jobs:
- {UTEST: "rtsmart/arm", RTT_BSP: "bsp/qemu-vexpress-a9", QEMU_ARCH: "arm", QEMU_MACHINE: "vexpress-a9", CONFIG_FILE: "rtsmart/base.conf", SD_FILE: "sd.bin", RUN: "no"}
- {UTEST: "rtsmart/aarch64", RTT_BSP: "bsp/qemu-virt64-aarch64", QEMU_ARCH: "aarch64", QEMU_MACHINE: "virt", CONFIG_FILE: "rtsmart/base.conf", SD_FILE: "sd.bin", RUN: "no"}
- {UTEST: "rtsmart/riscv64", RTT_BSP: "bsp/qemu-virt64-riscv", QEMU_ARCH: "riscv64", QEMU_MACHINE: "virt", CONFIG_FILE: "rtsmart/base.conf", SD_FILE: "None", RUN: "yes"}
- {UTEST: "rtsmart/mlibc/riscv64", RTT_BSP: "bsp/qemu-virt64-riscv", QEMU_ARCH: "riscv64", QEMU_MACHINE: "virt", CONFIG_FILE: "rtsmart/mlibc.conf", SD_FILE: "None", RUN: "yes"}
env:
TEST_QEMU_ARCH: ${{ matrix.legs.QEMU_ARCH }}
TEST_QEMU_MACHINE: ${{ matrix.legs.QEMU_MACHINE }}
Expand Down
2 changes: 2 additions & 0 deletions components/lwp/lwp.c
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,8 @@ pid_t lwp_execve(char *filename, int debug, int argc, char **argv, char **envp)

#ifdef RT_USING_MUSLLIBC
extern char **__environ;
#elif defined(RT_USING_MLIBC)
extern char **__environ;
#else
char **__environ = 0;
#endif
Expand Down
6 changes: 6 additions & 0 deletions components/lwp/lwp.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ struct lwp_tty;
#define LWP_CREATE_STAT_SIGNALED(signo, coredump) (((signo) & 0x7f) | (coredump ? LWP_COREDUMP_FLAG : 0))
#define LWP_CREATE_STAT_STOPPED(signo) (LWP_CREATE_STAT_EXIT(signo) | 0x7f)
#define LWP_CREATE_STAT_CONTINUED (0xffff)
#elif defined(RT_USING_MLIBC)
#define LWP_COREDUMP_FLAG 0x80
#define LWP_CREATE_STAT_EXIT(exit_code) (((exit_code)&0xff) << 8)
#define LWP_CREATE_STAT_SIGNALED(signo, coredump) (((signo) & 0x7f) | (coredump ? LWP_COREDUMP_FLAG : 0))
#define LWP_CREATE_STAT_STOPPED(signo) (LWP_CREATE_STAT_EXIT(signo) | 0x7f)
#define LWP_CREATE_STAT_CONTINUED (0xffff)
#else
#error "No compatible lwp set status provided for this libc"
#endif
Expand Down
1 change: 1 addition & 0 deletions components/lwp/lwp_syscall.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include <mm_aspace.h>
#include <lwp_user_mm.h>
#include <lwp_arch.h>
#include <bsd_porting.h>
#endif

#include <fcntl.h>
Expand Down
4 changes: 4 additions & 0 deletions components/lwp/lwp_user_mm.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
#include <mm_fault.h>
#include <mm_page.h>

#ifdef RT_USING_MLIBC
#include <sys/mman.h>
#endif

#ifdef __cplusplus
extern "C" {
#endif
Expand Down
21 changes: 21 additions & 0 deletions examples/utest/configs/rtsmart/mlibc.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# mlibc
CONFIG_RT_USING_EXTERNAL_LIBC=y
CONFIG_PKG_USING_MLIBC=y
CONFIG_PKG_MLIBC_PATH="/packages/system/mlibc"
CONFIG_PKG_USING_MLIBC_LATEST_VERSION=y
CONFIG_PKG_MLIBC_VER="latest"

# testcase
CONFIG_RT_USING_MEMHEAP=y
CONFIG_UTEST_MEMHEAP_TC=y

# RT-Smart
CONFIG_RT_USING_SMART=y
CONFIG_RT_USING_POSIX_EVENTFD=y
CONFIG_RT_USING_POSIX_EPOLL=y
CONFIG_RT_USING_POSIX_SIGNALFD=y
CONFIG_RT_SIGNALFD_MAX_NUM=10
CONFIG_RT_USING_POSIX_TIMERFD=y

# misc
CONFIG_RT_USING_DFS_V2=y

0 comments on commit f067dbb

Please sign in to comment.