diff --git a/_user/sharedlib/Makefile b/_user/sharedlib/Makefile new file mode 100644 index 00000000..272af188 --- /dev/null +++ b/_user/sharedlib/Makefile @@ -0,0 +1,18 @@ +# +# Makefile for user application +# +# Copyright 2024 Phoenix Systems +# + +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) 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 3375557c..77c8fec1 160000 --- a/libphoenix +++ b/libphoenix @@ -1 +1 @@ -Subproject commit 3375557c923188ec8e773bf3a7780cbb13aa560d +Subproject commit 77c8fec19a72769cf47abaaf69a44e6d3f889f0a diff --git a/phoenix-rtos-build b/phoenix-rtos-build index f995fe12..b74f360f 160000 --- a/phoenix-rtos-build +++ b/phoenix-rtos-build @@ -1 +1 @@ -Subproject commit f995fe12645836c34a84f8d79ff3033d8d4c608c +Subproject commit b74f360f09c6cfe5254971e0b0ed6df3107a8cc3 diff --git a/phoenix-rtos-kernel b/phoenix-rtos-kernel index 1476a025..83870262 160000 --- a/phoenix-rtos-kernel +++ b/phoenix-rtos-kernel @@ -1 +1 @@ -Subproject commit 1476a025050391cc0e8bf423be7d8f8b94820078 +Subproject commit 838702628649f6f156864c49aa4f16376826e991 diff --git a/phoenix-rtos-utils b/phoenix-rtos-utils index aa4360f0..eb74cd6e 160000 --- a/phoenix-rtos-utils +++ b/phoenix-rtos-utils @@ -1 +1 @@ -Subproject commit aa4360f039b324abbcba61238a3f5a885c4a4be2 +Subproject commit eb74cd6eaab138dd05765f36384c9f99f095a5c9