Made the RTX thread run with the maximum priority on ARM Cortex targets
This commit is contained in:
parent
73629b308c
commit
a02b693843
|
|
@ -1 +1 @@
|
||||||
Subproject commit ce4f09edb241165b6d086588471c9939daf97dbf
|
Subproject commit fef1263a5df00d0f5d979e173c635d83be9388d1
|
||||||
|
|
@ -93,7 +93,8 @@ stm32f405_inc = ['platform/mcu/CMSIS/Include',
|
||||||
'platform/mcu/STM32F4xx/drivers',
|
'platform/mcu/STM32F4xx/drivers',
|
||||||
'platform/mcu/STM32F4xx/drivers/usb']
|
'platform/mcu/STM32F4xx/drivers/usb']
|
||||||
|
|
||||||
stm32f405_def = {'STM32F40_41xxx': '', 'HSE_VALUE':'8000000'}
|
stm32f405_def = {'STM32F40_41xxx': '', 'HSE_VALUE':'8000000',
|
||||||
|
'_POSIX_PRIORITY_SCHEDULING':''}
|
||||||
|
|
||||||
## MK22FN512
|
## MK22FN512
|
||||||
|
|
||||||
|
|
@ -116,7 +117,7 @@ mk22fn512_inc = ['platform/mcu/CMSIS/Include',
|
||||||
'platform/mcu/CMSIS/Device/NXP/MK22FN512xxx12/Include',
|
'platform/mcu/CMSIS/Device/NXP/MK22FN512xxx12/Include',
|
||||||
'platform/mcu/MK22FN512xxx12/drivers']
|
'platform/mcu/MK22FN512xxx12/drivers']
|
||||||
|
|
||||||
mk22fn512_def = {}
|
mk22fn512_def = {'_POSIX_PRIORITY_SCHEDULING':''}
|
||||||
|
|
||||||
##
|
##
|
||||||
## Platform specializations
|
## Platform specializations
|
||||||
|
|
|
||||||
|
|
@ -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 <http://www.gnu.org/licenses/> *
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <app_cfg.h>
|
|
||||||
#include <os.h>
|
|
||||||
#include <hwconfig.h>
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 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(;;) ;
|
|
||||||
}
|
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
#include <hwconfig.h>
|
#include <hwconfig.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
#include <sched.h>
|
||||||
#include <ui.h>
|
#include <ui.h>
|
||||||
#include <state.h>
|
#include <state.h>
|
||||||
#include <threads.h>
|
#include <threads.h>
|
||||||
|
|
@ -326,6 +327,14 @@ void create_threads()
|
||||||
|
|
||||||
pthread_attr_init(&rtx_attr);
|
pthread_attr_init(&rtx_attr);
|
||||||
pthread_attr_setstacksize(&rtx_attr, RTX_TASK_STKSIZE);
|
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);
|
pthread_create(&rtx_thread, &rtx_attr, rtx_task, NULL);
|
||||||
|
|
||||||
// Create UI thread
|
// Create UI thread
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue