From e6d27f019ee34f72b3e51e396a4368407d025784 Mon Sep 17 00:00:00 2001 From: Mark Charlebois Date: Mon, 25 Jan 2016 18:28:21 -0800 Subject: [PATCH] Added missing stub functions for qurt build No wchar support in current aDSP image. Signed-off-by: Mark Charlebois --- src/platforms/qurt/dspal/dspal_stub.c | 28 +--- .../qurt/px4_layer/px4_qurt_impl.cpp | 156 +++++++++++++++++- 2 files changed, 153 insertions(+), 31 deletions(-) diff --git a/src/platforms/qurt/dspal/dspal_stub.c b/src/platforms/qurt/dspal/dspal_stub.c index 325c08a6b5..dd97f4fc8a 100644 --- a/src/platforms/qurt/dspal/dspal_stub.c +++ b/src/platforms/qurt/dspal/dspal_stub.c @@ -30,43 +30,18 @@ * POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************/ +#ifdef QURT_EXE_BUILD #include #include -//#define STACK_SIZE 0x8000 -//static char __attribute__ ((aligned (16))) stack1[STACK_SIZE]; - static void do_dlopen() { -#if 0 - void *handle; - char *error; - void (*entry_function)() = NULL; - - handle = dlopen("libdspal_client.so", RTLD_LAZY); - - if (!handle) { - printf("Error opening libdspal_client.so\n"); - return 1; - } - - entry_function = dlsym(handle, "dspal_entry"); - - if (((error = dlerror()) != NULL) || (entry_function == NULL)) { - printf("Error dlsym for dspal_entry"); - ret = 2; - } - - dlclose(handle); -#endif } -#ifdef QURT_EXE_BUILD int dlinit(int a, char **b) { return 0; } -#endif int main(int argc, char *argv[]) { @@ -80,3 +55,4 @@ int main(int argc, char *argv[]) return ret; } +#endif diff --git a/src/platforms/qurt/px4_layer/px4_qurt_impl.cpp b/src/platforms/qurt/px4_layer/px4_qurt_impl.cpp index bc425fd66a..a75a47692a 100644 --- a/src/platforms/qurt/px4_layer/px4_qurt_impl.cpp +++ b/src/platforms/qurt/px4_layer/px4_qurt_impl.cpp @@ -157,18 +157,17 @@ size_t strnlen(const char *s, size_t maxlen) return i; } -int ioctl(int a, int b, unsigned long c) -{ - return -1; -} - int write(int a, char const *b, int c) { + PX4_ERR("Error: Calling unresolved symbol stub[%s]", __FUNCTION__); + block_indefinite(); return -1; } int fprintf(FILE *stream, const char *format, ...) { + PX4_ERR("Error: Calling unresolved symbol stub[%s]", __FUNCTION__); + block_indefinite(); return 0; } @@ -177,4 +176,151 @@ int fputc(int c, FILE *stream) return c; } +FILE _Stdin; +FILE _Stdout; FILE _Stderr; + +static void block_indefinite(void) +{ + for (;;) { + volatile int x = 0; + ++x; + } +} + +int ungetc(int c, FILE *stream) +{ + PX4_ERR("Error: Calling unresolved symbol stub[%s]", __FUNCTION__); + block_indefinite(); + return -1; +} + +int fgetc(FILE *stream) +{ + PX4_ERR("Error: Calling unresolved symbol stub[%s]", __FUNCTION__); + block_indefinite(); + return -1; +} + +int fseek(FILE *stream, long offset, int whence) +{ + PX4_ERR("Error: Calling unresolved symbol stub[%s]", __FUNCTION__); + block_indefinite(); + return -1; +} + +int fgetpos(FILE *stream, fpos_t *pos) +{ + PX4_ERR("Error: Calling unresolved symbol stub[%s]", __FUNCTION__); + block_indefinite(); + return -1; +} +int fsetpos(FILE *stream, const fpos_t *pos) +{ + PX4_ERR("Error: Calling unresolved symbol stub[%s]", __FUNCTION__); + block_indefinite(); + return -1; +} + +int setvbuf(FILE *stream, char *buf, int mode, size_t size) +{ + PX4_ERR("Error: Calling unresolved symbol stub[%s]", __FUNCTION__); + block_indefinite(); + return -1; +} + +#include + +wint_t fputwc(wchar_t wc, FILE *stream) +{ + PX4_ERR("Error: Calling unresolved symbol stub[%s]", __FUNCTION__); + block_indefinite(); + return -1; +} + +wint_t ungetwc(wint_t wc, FILE *stream) +{ + PX4_ERR("Error: Calling unresolved symbol stub[%s]", __FUNCTION__); + block_indefinite(); + return -1; +} + +wint_t fgetwc(FILE *stream) +{ + PX4_ERR("Error: Calling unresolved symbol stub[%s]", __FUNCTION__); + block_indefinite(); + return -1; +} + +#include + +size_t _Getmbcurmax() +{ + PX4_ERR("Error: Calling unresolved symbol stub[%s]", __FUNCTION__); + block_indefinite(); + return 2; +} + +#include + +_Ctype_t _Getptolower(void) +{ + PX4_ERR("Error: Calling unresolved symbol stub[%s]", __FUNCTION__); + block_indefinite(); + return nullptr; +} + +_Ctype_t _Getptoupper(void) +{ + PX4_ERR("Error: Calling unresolved symbol stub[%s]", __FUNCTION__); + block_indefinite(); + return nullptr; +} + +#include + +_Statab *_Getpmbstate(void) +{ + PX4_ERR("Error: Calling unresolved symbol stub[%s]", __FUNCTION__); + block_indefinite(); + return nullptr; +} + +_Statab *_Getpwcstate(void) +{ + PX4_ERR("Error: Calling unresolved symbol stub[%s]", __FUNCTION__); + block_indefinite(); + return nullptr; +} + +int _Mbtowcx(wchar_t *, const char *, size_t, mbstate_t *, _Statab *) +{ + PX4_ERR("Error: Calling unresolved symbol stub[%s]", __FUNCTION__); + block_indefinite(); + return -1; +} + +int _Wctombx(char *, wchar_t, mbstate_t *, _Statab *, _Statab *) +{ + PX4_ERR("Error: Calling unresolved symbol stub[%s]", __FUNCTION__); + return -1; +} + +void _Locksyslock(int x) +{ + PX4_ERR("Error: Calling unresolved symbol stub[%s]", __FUNCTION__); + block_indefinite(); +} + +void _Unlocksyslock(int x) +{ + PX4_ERR("Error: Calling unresolved symbol stub[%s]", __FUNCTION__); + block_indefinite(); +} + +void _Atexit(void (*)(void)) +{ + PX4_ERR("Error: Calling unresolved symbol stub[%s]", __FUNCTION__); + block_indefinite(); +} +