diff --git a/_projects/armv7a7-imx6ull-evk/rootfs-overlay/etc/rc.psh b/_projects/armv7a7-imx6ull-evk/rootfs-overlay/etc/rc.psh index 7e2508a9..584f5d55 100644 --- a/_projects/armv7a7-imx6ull-evk/rootfs-overlay/etc/rc.psh +++ b/_projects/armv7a7-imx6ull-evk/rootfs-overlay/etc/rc.psh @@ -7,4 +7,5 @@ W /sbin/dummyfs -m /var -D W /sbin/dummyfs -m /tmp -D X /sbin/lwip enet:0x02188000:150:PHY:0.2:irq:-5:/dev/gpio5 enet:0x020b4000:152:no-mdio:PHY:0.1:irq:-6:/dev/gpio5 X /bin/posixsrv +W /bin/ldconfig X /bin/psh diff --git a/_projects/armv7a9-zynq7000-qemu/rootfs-overlay/etc/rc.psh b/_projects/armv7a9-zynq7000-qemu/rootfs-overlay/etc/rc.psh index 75ebe493..49b710ec 100755 --- a/_projects/armv7a9-zynq7000-qemu/rootfs-overlay/etc/rc.psh +++ b/_projects/armv7a9-zynq7000-qemu/rootfs-overlay/etc/rc.psh @@ -5,4 +5,5 @@ W /bin/bind devfs /dev W /sbin/dummyfs -m /tmp -D X /bin/posixsrv T /dev/console +W /bin/ldconfig X /linuxrc diff --git a/_projects/armv7a9-zynq7000-zedboard/rootfs-overlay/etc/rc.psh b/_projects/armv7a9-zynq7000-zedboard/rootfs-overlay/etc/rc.psh index 55b8f507..d225120d 100644 --- a/_projects/armv7a9-zynq7000-zedboard/rootfs-overlay/etc/rc.psh +++ b/_projects/armv7a9-zynq7000-zedboard/rootfs-overlay/etc/rc.psh @@ -4,4 +4,5 @@ export HOME=/root W /bin/bind devfs /dev W /sbin/dummyfs -m /tmp -D X /bin/posixsrv +W /bin/ldconfig X /bin/psh diff --git a/_projects/ia32-generic-qemu/rootfs-overlay/etc/rc.psh b/_projects/ia32-generic-qemu/rootfs-overlay/etc/rc.psh index 803b70d7..74237c7f 100755 --- a/_projects/ia32-generic-qemu/rootfs-overlay/etc/rc.psh +++ b/_projects/ia32-generic-qemu/rootfs-overlay/etc/rc.psh @@ -6,4 +6,5 @@ W /sbin/dummyfs -m /tmp -D X /bin/posixsrv X /sbin/lwip rtl:0x18:11 T /dev/console +W /bin/ldconfig X /bin/psh diff --git a/_projects/riscv64-generic-qemu/rootfs-overlay/etc/rc.psh b/_projects/riscv64-generic-qemu/rootfs-overlay/etc/rc.psh index 55b8f507..d225120d 100644 --- a/_projects/riscv64-generic-qemu/rootfs-overlay/etc/rc.psh +++ b/_projects/riscv64-generic-qemu/rootfs-overlay/etc/rc.psh @@ -4,4 +4,5 @@ export HOME=/root W /bin/bind devfs /dev W /sbin/dummyfs -m /tmp -D X /bin/posixsrv +W /bin/ldconfig X /bin/psh diff --git a/_projects/sparcv8leon3-generic-qemu/rootfs-overlay/etc/rc.psh b/_projects/sparcv8leon3-generic-qemu/rootfs-overlay/etc/rc.psh new file mode 100644 index 00000000..6a81cbd8 --- /dev/null +++ b/_projects/sparcv8leon3-generic-qemu/rootfs-overlay/etc/rc.psh @@ -0,0 +1,6 @@ +:{}: +export PATH=/bin:/sbin:/usr/bin:/usr/sbin +export HOME=/root +W /bin/bind devfs /dev +X /bin/posixsrv +X /bin/psh diff --git a/_user/dlopen/Makefile b/_user/dlopen/Makefile new file mode 100644 index 00000000..90ccde7f --- /dev/null +++ b/_user/dlopen/Makefile @@ -0,0 +1,20 @@ +# +# Makefile for user application +# +# Copyright 2024 Phoenix Systems +# +ifeq ($(HAVE_SHLIB), y) + +NAME := libhello +LOCAL_HEADERS := hello.h +LOCAL_SRCS := hello.c + +include $(shared-lib.mk) + + +NAME := dlopen +LOCAL_SRCS := main.c + +include $(binary-dyn.mk) + +endif diff --git a/_user/dlopen/hello.c b/_user/dlopen/hello.c new file mode 100644 index 00000000..bd7767f0 --- /dev/null +++ b/_user/dlopen/hello.c @@ -0,0 +1,24 @@ +/* + * Phoenix-RTOS + * + * dlopen + * + * Example of user application using dlopen. + * + * Copyright 2024 Phoenix Systems + * Author: Hubert Badocha + * + * This file is part of Phoenix-RTOS. + * + * %LICENSE% + */ + +#include "hello.h" + +#include + + +int hello(void) +{ + return printf("Hello shared world!\n"); +} diff --git a/_user/dlopen/hello.h b/_user/dlopen/hello.h new file mode 100644 index 00000000..7637be1f --- /dev/null +++ b/_user/dlopen/hello.h @@ -0,0 +1,21 @@ +/* + * Phoenix-RTOS + * + * dlopen + * + * Example of user application using dlopen. + * + * Copyright 2024 Phoenix Systems + * Author: Hubert Badocha + * + * This file is part of Phoenix-RTOS. + * + * %LICENSE% + */ + +#ifndef _USER_DLOPEN_DYN_H_ +#define _USER_DLOPEN_DYN_H_ + +int hello(void); + +#endif diff --git a/_user/dlopen/main.c b/_user/dlopen/main.c new file mode 100644 index 00000000..0b14f7c2 --- /dev/null +++ b/_user/dlopen/main.c @@ -0,0 +1,40 @@ +/* + * Phoenix-RTOS + * + * dlopen + * + * Example of user application using dlopen. + * + * Copyright 2024 Phoenix Systems + * Author: Hubert Badocha + * + * This file is part of Phoenix-RTOS. + * + * %LICENSE% + */ + +#include +#include +#include +#include + +int main(void) +{ + void *handle = dlopen("/usr/lib/libhello.so", RTLD_LAZY); + if (handle == NULL) { + printf("%s\n", dlerror()); + return 1; + } + int (*hello)(void) = (int (*)(void))dlsym(handle, "hello"); + if (hello == NULL) { + printf("%s\n", dlerror()); + (void)dlclose(handle); + return 1; + } + + hello(); + + (void)dlclose(handle); + + return 0; +} diff --git a/_user/sharedlib/Makefile b/_user/sharedlib/Makefile new file mode 100644 index 00000000..8adb4b7f --- /dev/null +++ b/_user/sharedlib/Makefile @@ -0,0 +1,21 @@ +# +# Makefile for user application +# +# Copyright 2024 Phoenix Systems +# +ifeq ($(HAVE_SHLIB), y) + +NAME := libdyn +LOCAL_HEADERS := dyn.h +LOCAL_SRCS := dyn.c + +include $(shared-lib.mk) + + +NAME := sharedlib +LOCAL_SRCS := main.c +DEP_LIBS_SHARED := libdyn + +include $(binary-dyn.mk) + +endif diff --git a/_user/sharedlib/dyn.c b/_user/sharedlib/dyn.c new file mode 100644 index 00000000..281f0321 --- /dev/null +++ b/_user/sharedlib/dyn.c @@ -0,0 +1,25 @@ +/* + * Phoenix-RTOS + * + * sharedlib + * + * Example of user application using shared libraries. + * + * Copyright 2024 Phoenix Systems + * Author: Hubert Badocha + * + * This file is part of Phoenix-RTOS. + * + * %LICENSE% + */ + +#include "dyn.h" + + +extern void *_DYNAMIC; + + +void *dyn(void) +{ + return &_DYNAMIC; +} diff --git a/_user/sharedlib/dyn.h b/_user/sharedlib/dyn.h new file mode 100644 index 00000000..02ce4ed7 --- /dev/null +++ b/_user/sharedlib/dyn.h @@ -0,0 +1,22 @@ +/* + * Phoenix-RTOS + * + * sharedlib + * + * Example of user application using shared libraries. + * + * Copyright 2024 Phoenix Systems + * Author: Hubert Badocha + * + * This file is part of Phoenix-RTOS. + * + * %LICENSE% + */ + + +#ifndef _USER_SHAREDLIB_DYN_H_ +#define _USER_SHAREDLIB_DYN_H_ + +void *dyn(void); + +#endif diff --git a/_user/sharedlib/main.c b/_user/sharedlib/main.c new file mode 100644 index 00000000..904214b4 --- /dev/null +++ b/_user/sharedlib/main.c @@ -0,0 +1,25 @@ +/* + * Phoenix-RTOS + * + * sharedlib + * + * Example of user application using shared libraries. + * + * Copyright 2024 Phoenix Systems + * Author: Hubert Badocha + * + * This file is part of Phoenix-RTOS. + * + * %LICENSE% + */ + +#include + +#include "dyn.h" + +int main(void) +{ + printf("Dynamic section pointer %p\n", dyn()); + + return 0; +} diff --git a/libphoenix b/libphoenix index 4301a199..6f49a088 160000 --- a/libphoenix +++ b/libphoenix @@ -1 +1 @@ -Subproject commit 4301a199e126c75a5c239c02d55f8a719997ca61 +Subproject commit 6f49a0880123fc1bb5de426426b8b7b7465c2aa9 diff --git a/phoenix-rtos-build b/phoenix-rtos-build index db401049..fb8a10c7 160000 --- a/phoenix-rtos-build +++ b/phoenix-rtos-build @@ -1 +1 @@ -Subproject commit db40104978effe980ec1a2420e8e32cadda80acf +Subproject commit fb8a10c738cd174bc670e7a786758c405e32bc6f diff --git a/phoenix-rtos-kernel b/phoenix-rtos-kernel index 2ea33db3..3caf5fd0 160000 --- a/phoenix-rtos-kernel +++ b/phoenix-rtos-kernel @@ -1 +1 @@ -Subproject commit 2ea33db393ce9d4ee67b9c06bd391d1ddb928d98 +Subproject commit 3caf5fd00d1c9bee2b88fc159a88cefef107caf6 diff --git a/phoenix-rtos-tests b/phoenix-rtos-tests index c3b2ba69..783270b7 160000 --- a/phoenix-rtos-tests +++ b/phoenix-rtos-tests @@ -1 +1 @@ -Subproject commit c3b2ba6920a3d2425a8e501eaefc3ac7aabd8993 +Subproject commit 783270b74b96834d2aa3b2b9eed227151cb6d044 diff --git a/phoenix-rtos-utils b/phoenix-rtos-utils index ec185a49..84e1f14b 160000 --- a/phoenix-rtos-utils +++ b/phoenix-rtos-utils @@ -1 +1 @@ -Subproject commit ec185a49e3ed0a14baf30a0d93ff723ed74d9c9e +Subproject commit 84e1f14b83c0e9bbaaef78661e9bfc82380e4a7b