diff --git a/lib/miosix-kernel b/lib/miosix-kernel index ce4f09ed..fef1263a 160000 --- a/lib/miosix-kernel +++ b/lib/miosix-kernel @@ -1 +1 @@ -Subproject commit ce4f09edb241165b6d086588471c9939daf97dbf +Subproject commit fef1263a5df00d0f5d979e173c635d83be9388d1 diff --git a/meson.build b/meson.build index d23e3b8c..6b9d3716 100644 --- a/meson.build +++ b/meson.build @@ -93,7 +93,8 @@ stm32f405_inc = ['platform/mcu/CMSIS/Include', 'platform/mcu/STM32F4xx/drivers', 'platform/mcu/STM32F4xx/drivers/usb'] -stm32f405_def = {'STM32F40_41xxx': '', 'HSE_VALUE':'8000000'} +stm32f405_def = {'STM32F40_41xxx': '', 'HSE_VALUE':'8000000', + '_POSIX_PRIORITY_SCHEDULING':''} ## MK22FN512 @@ -116,7 +117,7 @@ mk22fn512_inc = ['platform/mcu/CMSIS/Include', 'platform/mcu/CMSIS/Device/NXP/MK22FN512xxx12/Include', 'platform/mcu/MK22FN512xxx12/drivers'] -mk22fn512_def = {} +mk22fn512_def = {'_POSIX_PRIORITY_SCHEDULING':''} ## ## Platform specializations diff --git a/openrtx/src/bootstrap.c b/openrtx/src/bootstrap.c deleted file mode 100644 index 1d241651..00000000 --- a/openrtx/src/bootstrap.c +++ /dev/null @@ -1,86 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2020 by Federico Izzo IU2NUO, Niccolò Izzo IU2KIN and * - * Silvano Seva IU2KWO * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 3 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, see * - ***************************************************************************/ - -#include -#include -#include -#include - -/* - * Entry point for application code, not in this translation unit. - */ -int main(int argc, char *argv[]); - -/* - * OS startup task, will call main() when all initialisations are done. - */ - -#ifdef RUN_TESTSUITE -#define START_TSK_STKSIZE 4096/sizeof(CPU_STK) -#else -#define START_TSK_STKSIZE 512/sizeof(CPU_STK) -#endif - -static OS_TCB startTCB; -static CPU_STK startStk[START_TSK_STKSIZE]; -static void startTask(void *arg); - -void systemBootstrap() -{ - OS_ERR err; - - OSInit(&err); - - OSTaskCreate((OS_TCB *) &startTCB, - (CPU_CHAR *) " ", - (OS_TASK_PTR ) startTask, - (void *) 0, - (OS_PRIO ) APP_CFG_TASK_START_PRIO, - (CPU_STK *) &startStk[0], - (CPU_STK ) startStk[START_TSK_STKSIZE / 10u], - (CPU_STK_SIZE) START_TSK_STKSIZE, - (OS_MSG_QTY ) 0, - (OS_TICK ) 0, - (void *) 0, - (OS_OPT ) (OS_OPT_TASK_STK_CHK | OS_OPT_TASK_STK_CLR), - (OS_ERR *) &err); - - OSStart(&err); - - for(;;) ; -} - -static void startTask(void* arg) -{ - (void) arg; - - CPU_Init(); - - /* On ARM-based targets setup SysTick */ - #ifdef __arm__ - OS_CPU_SysTickInitFreq(SystemCoreClock); - #else - OS_CPU_SysTickInit(); - #endif - - /* Jump to application code */ - main(0, NULL); - - /* If main returns loop indefinitely */ - for(;;) ; -} diff --git a/openrtx/src/threads.c b/openrtx/src/threads.c index 66234a42..134cf7e0 100644 --- a/openrtx/src/threads.c +++ b/openrtx/src/threads.c @@ -20,6 +20,7 @@ #include #include +#include #include #include #include @@ -326,6 +327,14 @@ void create_threads() pthread_attr_init(&rtx_attr); pthread_attr_setstacksize(&rtx_attr, RTX_TASK_STKSIZE); + + #ifdef _MIOSIX + // Max priority for RTX thread when running with miosix rtos + struct sched_param param; + param.sched_priority = sched_get_priority_max(0); + pthread_attr_setschedparam(&rtx_attr, ¶m); + #endif + pthread_create(&rtx_thread, &rtx_attr, rtx_task, NULL); // Create UI thread