fix: remove project files
update README.md file to remove the project files close https://gitee.com/openharmony/kernel_liteos_m/issues/I3U5QQ Signed-off-by: kenneth <459864689@qq.com>
This commit is contained in:
parent
05937ee49c
commit
4ad01ced93
|
@ -1,126 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
|
||||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
|
||||||
* are permitted provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
|
||||||
* conditions and the following disclaimer.
|
|
||||||
*
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
|
||||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
|
||||||
* provided with the distribution.
|
|
||||||
*
|
|
||||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
|
||||||
* to endorse or promote products derived from this software without specific prior written
|
|
||||||
* permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
||||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
|
||||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
||||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
|
||||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
|
||||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "los_tick.h"
|
|
||||||
#include "los_task.h"
|
|
||||||
#include "los_config.h"
|
|
||||||
#include "los_interrupt.h"
|
|
||||||
#include "los_debug.h"
|
|
||||||
#include "los_compiler.h"
|
|
||||||
|
|
||||||
|
|
||||||
#pragma data_alignment=8
|
|
||||||
UINT8 g_memStart[LOSCFG_SYS_HEAP_SIZE];
|
|
||||||
|
|
||||||
VOID taskSampleEntry2(VOID)
|
|
||||||
{
|
|
||||||
while(1) {
|
|
||||||
LOS_TaskDelay(10000);
|
|
||||||
printf("taskSampleEntry2 running...\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
VOID taskSampleEntry1(VOID)
|
|
||||||
{
|
|
||||||
while(1) {
|
|
||||||
LOS_TaskDelay(2000);
|
|
||||||
printf("taskSampleEntry1 running...\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
UINT32 taskSample(VOID)
|
|
||||||
{
|
|
||||||
UINT32 uwRet;
|
|
||||||
UINT32 taskID1,taskID2;
|
|
||||||
TSK_INIT_PARAM_S stTask1={0};
|
|
||||||
stTask1.pfnTaskEntry = (TSK_ENTRY_FUNC)taskSampleEntry1;
|
|
||||||
stTask1.uwStackSize = 0X1000;
|
|
||||||
stTask1.pcName = "taskSampleEntry1";
|
|
||||||
stTask1.usTaskPrio = 6;
|
|
||||||
uwRet = LOS_TaskCreate(&taskID1, &stTask1);
|
|
||||||
if (uwRet != LOS_OK) {
|
|
||||||
printf("create task1 failed\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
stTask1.pfnTaskEntry = (TSK_ENTRY_FUNC)taskSampleEntry2;
|
|
||||||
stTask1.uwStackSize = 0X1000;
|
|
||||||
stTask1.pcName = "taskSampleEntry2";
|
|
||||||
stTask1.usTaskPrio = 7;
|
|
||||||
uwRet = LOS_TaskCreate(&taskID2, &stTask1);
|
|
||||||
if (uwRet != LOS_OK) {
|
|
||||||
printf("create task2 failed\n");
|
|
||||||
}
|
|
||||||
return LOS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void LOS_HardBootInit()
|
|
||||||
{
|
|
||||||
UINT32 uwRet = LOS_OK;
|
|
||||||
|
|
||||||
uwRet = LOS_UartBaseInit();
|
|
||||||
if (uwRet != LOS_OK)
|
|
||||||
{
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
|
||||||
Function : main
|
|
||||||
Description : Main function entry
|
|
||||||
Input : None
|
|
||||||
Output : None
|
|
||||||
Return : None
|
|
||||||
*****************************************************************************/
|
|
||||||
LITE_OS_SEC_TEXT_INIT int main(void)
|
|
||||||
{
|
|
||||||
unsigned int ret;
|
|
||||||
|
|
||||||
//USART_Config();
|
|
||||||
|
|
||||||
printf("\n\rhello world!!\n\r");
|
|
||||||
|
|
||||||
ret = LOS_KernelInit();
|
|
||||||
taskSample();
|
|
||||||
if (ret == LOS_OK) {
|
|
||||||
LOS_Start();
|
|
||||||
}
|
|
||||||
|
|
||||||
while (1) {
|
|
||||||
__asm volatile("wfi");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,116 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
|
||||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
|
||||||
* are permitted provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
|
||||||
* conditions and the following disclaimer.
|
|
||||||
*
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
|
||||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
|
||||||
* provided with the distribution.
|
|
||||||
*
|
|
||||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
|
||||||
* to endorse or promote products derived from this software without specific prior written
|
|
||||||
* permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
||||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
|
||||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
||||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
|
||||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
|
||||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**@defgroup los_config System configuration items
|
|
||||||
* @ingroup kernel
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _TARGET_CONFIG_H
|
|
||||||
#define _TARGET_CONFIG_H
|
|
||||||
|
|
||||||
#include "ARMCM3.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
#if __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
/*=============================================================================
|
|
||||||
System clock module configuration
|
|
||||||
=============================================================================*/
|
|
||||||
#define OS_SYS_CLOCK 24000000
|
|
||||||
#define LOSCFG_BASE_CORE_TICK_PER_SECOND (1000UL)
|
|
||||||
#define LOSCFG_BASE_CORE_TICK_HW_TIME 0
|
|
||||||
#define LOSCFG_BASE_CORE_TICK_WTIMER 0
|
|
||||||
#define LOSCFG_BASE_CORE_TICK_RESPONSE_MAX 0xFFFFFF
|
|
||||||
|
|
||||||
/*=============================================================================
|
|
||||||
Hardware interrupt module configuration
|
|
||||||
=============================================================================*/
|
|
||||||
#define LOSCFG_PLATFORM_HWI 1
|
|
||||||
#define LOSCFG_PLATFORM_HWI_LIMIT 128
|
|
||||||
/*=============================================================================
|
|
||||||
Task module configuration
|
|
||||||
=============================================================================*/
|
|
||||||
#define LOSCFG_BASE_CORE_TSK_LIMIT 24
|
|
||||||
#define LOSCFG_BASE_CORE_TSK_IDLE_STACK_SIZE (0x500U)
|
|
||||||
#define LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE (0x2D0U)
|
|
||||||
#define LOSCFG_BASE_CORE_TSK_MIN_STACK_SIZE (0x130U)
|
|
||||||
#define LOSCFG_BASE_CORE_TIMESLICE 1
|
|
||||||
#define LOSCFG_BASE_CORE_TIMESLICE_TIMEOUT 20000
|
|
||||||
/*=============================================================================
|
|
||||||
Semaphore module configuration
|
|
||||||
=============================================================================*/
|
|
||||||
#define LOSCFG_BASE_IPC_SEM 1
|
|
||||||
#define LOSCFG_BASE_IPC_SEM_LIMIT 48
|
|
||||||
/*=============================================================================
|
|
||||||
Mutex module configuration
|
|
||||||
=============================================================================*/
|
|
||||||
#define LOSCFG_BASE_IPC_MUX 1
|
|
||||||
#define LOSCFG_BASE_IPC_MUX_LIMIT 24
|
|
||||||
/*=============================================================================
|
|
||||||
Queue module configuration
|
|
||||||
=============================================================================*/
|
|
||||||
#define LOSCFG_BASE_IPC_QUEUE 1
|
|
||||||
#define LOSCFG_BASE_IPC_QUEUE_LIMIT 24
|
|
||||||
/*=============================================================================
|
|
||||||
Software timer module configuration
|
|
||||||
=============================================================================*/
|
|
||||||
#define LOSCFG_BASE_CORE_SWTMR 1
|
|
||||||
#define LOSCFG_BASE_CORE_SWTMR_ALIGN 1
|
|
||||||
#define LOSCFG_BASE_CORE_SWTMR_LIMIT 48
|
|
||||||
/*=============================================================================
|
|
||||||
Memory module configuration
|
|
||||||
=============================================================================*/
|
|
||||||
extern unsigned char g_memStart[];
|
|
||||||
#define LOSCFG_SYS_EXTERNAL_HEAP 1
|
|
||||||
#define LOSCFG_SYS_HEAP_ADDR (&g_memStart[0])
|
|
||||||
#define LOSCFG_SYS_HEAP_SIZE 0x00013000
|
|
||||||
#define LOSCFG_MEM_MUL_POOL 1
|
|
||||||
#define OS_SYS_MEM_NUM 20
|
|
||||||
/*=============================================================================
|
|
||||||
Exception module configuration
|
|
||||||
=============================================================================*/
|
|
||||||
#define LOSCFG_PLATFORM_EXC 1
|
|
||||||
/* =============================================================================
|
|
||||||
printf module configuration
|
|
||||||
============================================================================= */
|
|
||||||
#define LOSCFG_KERNEL_PRINTF 1
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
#if __cplusplus
|
|
||||||
}
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* _TARGET_CONFIG_H */
|
|
|
@ -1,184 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
|
||||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
|
||||||
* are permitted provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
|
||||||
* conditions and the following disclaimer.
|
|
||||||
*
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
|
||||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
|
||||||
* provided with the distribution.
|
|
||||||
*
|
|
||||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
|
||||||
* to endorse or promote products derived from this software without specific prior written
|
|
||||||
* permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
||||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
|
||||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
||||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
|
||||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
|
||||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "stdarg.h"
|
|
||||||
#include <stdio.h>
|
|
||||||
#include "los_debug.h"
|
|
||||||
#include "stm32f4xx_usart.h"
|
|
||||||
#include "stm324x9i_eval.h"
|
|
||||||
|
|
||||||
#define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Retargets the C library printf function to the USART.
|
|
||||||
* @param None
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
PUTCHAR_PROTOTYPE
|
|
||||||
{
|
|
||||||
/* Place your implementation of fputc here */
|
|
||||||
/* e.g. write a character to the USART */
|
|
||||||
USART_SendData(EVAL_COM1, (uint8_t) ch);
|
|
||||||
|
|
||||||
/* Loop until the end of transmission */
|
|
||||||
while (USART_GetFlagStatus(EVAL_COM1, USART_FLAG_TC) == RESET)
|
|
||||||
{}
|
|
||||||
|
|
||||||
return ch;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int hex2asc(int n)
|
|
||||||
{
|
|
||||||
n &= 15;
|
|
||||||
if(n > 9){
|
|
||||||
return ('a' - 10) + n;
|
|
||||||
} else {
|
|
||||||
return '0' + n;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void dputs(char const *s, int (*pFputc)(int n, FILE *cookie), void *cookie)
|
|
||||||
{
|
|
||||||
while (*s) {
|
|
||||||
pFputc(*s++, cookie);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void __dprintf(char const *fmt, va_list ap,
|
|
||||||
int (*pFputc)(int n, FILE *cookie),
|
|
||||||
void *cookie)
|
|
||||||
{
|
|
||||||
char scratch[256];
|
|
||||||
|
|
||||||
for(;;){
|
|
||||||
switch(*fmt){
|
|
||||||
case 0:
|
|
||||||
va_end(ap);
|
|
||||||
return;
|
|
||||||
case '%':
|
|
||||||
switch(fmt[1]) {
|
|
||||||
case 'c': {
|
|
||||||
unsigned n = va_arg(ap, unsigned);
|
|
||||||
pFputc(n, cookie);
|
|
||||||
fmt += 2;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
case 'h': {
|
|
||||||
unsigned n = va_arg(ap, unsigned);
|
|
||||||
pFputc(hex2asc(n >> 12), cookie);
|
|
||||||
pFputc(hex2asc(n >> 8), cookie);
|
|
||||||
pFputc(hex2asc(n >> 4), cookie);
|
|
||||||
pFputc(hex2asc(n >> 0), cookie);
|
|
||||||
fmt += 2;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
case 'b': {
|
|
||||||
unsigned n = va_arg(ap, unsigned);
|
|
||||||
pFputc(hex2asc(n >> 4), cookie);
|
|
||||||
pFputc(hex2asc(n >> 0), cookie);
|
|
||||||
fmt += 2;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
case 'p':
|
|
||||||
case 'X':
|
|
||||||
case 'x': {
|
|
||||||
unsigned n = va_arg(ap, unsigned);
|
|
||||||
char *p = scratch + 15;
|
|
||||||
*p = 0;
|
|
||||||
do {
|
|
||||||
*--p = hex2asc(n);
|
|
||||||
n = n >> 4;
|
|
||||||
} while(n != 0);
|
|
||||||
while(p > (scratch + 7)) *--p = '0';
|
|
||||||
dputs(p, pFputc, cookie);
|
|
||||||
fmt += 2;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
case 'd': {
|
|
||||||
int n = va_arg(ap, int);
|
|
||||||
char *p = scratch + 15;
|
|
||||||
*p = 0;
|
|
||||||
if(n < 0) {
|
|
||||||
pFputc('-', cookie);
|
|
||||||
n = -n;
|
|
||||||
}
|
|
||||||
do {
|
|
||||||
*--p = (n % 10) + '0';
|
|
||||||
n /= 10;
|
|
||||||
} while(n != 0);
|
|
||||||
dputs(p, pFputc, cookie);
|
|
||||||
fmt += 2;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
case 'u': {
|
|
||||||
unsigned int n = va_arg(ap, unsigned int);
|
|
||||||
char *p = scratch + 15;
|
|
||||||
*p = 0;
|
|
||||||
do {
|
|
||||||
*--p = (n % 10) + '0';
|
|
||||||
n /= 10;
|
|
||||||
} while(n != 0);
|
|
||||||
dputs(p, pFputc, cookie);
|
|
||||||
fmt += 2;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
case 's': {
|
|
||||||
char *s = va_arg(ap, char*); /*lint !e64*/
|
|
||||||
if(s == 0) s = "(null)";
|
|
||||||
dputs(s, pFputc, cookie);
|
|
||||||
fmt += 2;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pFputc(*fmt++, cookie);
|
|
||||||
break;
|
|
||||||
case '\n':
|
|
||||||
pFputc('\r', cookie);
|
|
||||||
default: /*lint !e616*/
|
|
||||||
pFputc(*fmt++, cookie);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void HalConsoleOutput(LogModuleType type, const char *fmt, va_list ap)
|
|
||||||
{
|
|
||||||
(void)type;
|
|
||||||
__dprintf(fmt, ap, fputc, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int printf(char const *fmt, ...)
|
|
||||||
{
|
|
||||||
va_list ap;
|
|
||||||
va_start(ap, fmt); /*lint !e1055 !e534 !e530*/
|
|
||||||
__dprintf(fmt, ap, fputc, 0); /*lint !e611 !e64*/
|
|
||||||
va_end(ap);
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,194 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
|
||||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
|
||||||
* are permitted provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
|
||||||
* conditions and the following disclaimer.
|
|
||||||
*
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
|
||||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
|
||||||
* provided with the distribution.
|
|
||||||
*
|
|
||||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
|
||||||
* to endorse or promote products derived from this software without specific prior written
|
|
||||||
* permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
||||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
|
||||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
||||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
|
||||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
|
||||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "los_tick.h"
|
|
||||||
#include "los_task.h"
|
|
||||||
#include "los_config.h"
|
|
||||||
#include "los_interrupt.h"
|
|
||||||
#include "los_debug.h"
|
|
||||||
#include "los_compiler.h"
|
|
||||||
#include "los_sched.h"
|
|
||||||
#include "iar_stm32f429ig_fire-challenger.h"
|
|
||||||
|
|
||||||
|
|
||||||
STATIC VOID TaskSampleEntry2(VOID)
|
|
||||||
{
|
|
||||||
while (1) {
|
|
||||||
printf("TaskSampleEntry2 running...\n");
|
|
||||||
LOS_TaskDelay(10000); /* 10 Seconds */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
STATIC VOID TaskSampleEntry1(VOID)
|
|
||||||
{
|
|
||||||
while (1) {
|
|
||||||
printf("TaskSampleEntry1 running...\n");
|
|
||||||
LOS_TaskDelay(2000); /* 2 Seconds */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
WEAK VOID TaskSample(VOID)
|
|
||||||
{
|
|
||||||
UINT32 uwRet;
|
|
||||||
UINT32 taskID1;
|
|
||||||
UINT32 taskID2;
|
|
||||||
TSK_INIT_PARAM_S stTask = {0};
|
|
||||||
|
|
||||||
stTask.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskSampleEntry1;
|
|
||||||
stTask.uwStackSize = 0x1000;
|
|
||||||
stTask.pcName = "TaskSampleEntry1";
|
|
||||||
stTask.usTaskPrio = 6; /* Os task priority is 6 */
|
|
||||||
uwRet = LOS_TaskCreate(&taskID1, &stTask);
|
|
||||||
if (uwRet != LOS_OK) {
|
|
||||||
printf("Task1 create failed\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
stTask.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskSampleEntry2;
|
|
||||||
stTask.uwStackSize = 0x1000;
|
|
||||||
stTask.pcName = "TaskSampleEntry2";
|
|
||||||
stTask.usTaskPrio = 7; /* Os task priority is 7 */
|
|
||||||
uwRet = LOS_TaskCreate(&taskID2, &stTask);
|
|
||||||
if (uwRet != LOS_OK) {
|
|
||||||
printf("Task2 create failed\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#if (LOSCFG_BASE_CORE_SCHED_SLEEP == 1)
|
|
||||||
#define SLEEP_TIME_CYCLE 90000000UL
|
|
||||||
#define SLEEP_TIME_MAX_RESPONSE_TIME ((UINT32)-1)
|
|
||||||
#define TIM2_INI_PRIORITY 3
|
|
||||||
unsigned int g_sleepTimePeriod;
|
|
||||||
TIM_TimeBaseInitTypeDef g_timerInit = { 0 };
|
|
||||||
unsigned long long GetSleepTimeNs(VOID)
|
|
||||||
{
|
|
||||||
unsigned long long currTime = g_sleepTimePeriod + TIM_GetCounter(TIM2);
|
|
||||||
currTime = (currTime * OS_SYS_NS_PER_SECOND) / SLEEP_TIME_CYCLE;
|
|
||||||
return currTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SleepTimerStop(void)
|
|
||||||
{
|
|
||||||
TIM_ClearITPendingBit(TIM2, TIM_FLAG_Update);
|
|
||||||
TIM_DeInit(TIM2);
|
|
||||||
TIM_Cmd(TIM2, DISABLE);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SleepTimerStart(unsigned long long sleepTimeNs)
|
|
||||||
{
|
|
||||||
unsigned long long period = (sleepTimeNs * SLEEP_TIME_CYCLE) / OS_SYS_NS_PER_SECOND;
|
|
||||||
if (period > SLEEP_TIME_MAX_RESPONSE_TIME) {
|
|
||||||
period = SLEEP_TIME_MAX_RESPONSE_TIME;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_timerInit.TIM_Period = period;
|
|
||||||
g_sleepTimePeriod = period;
|
|
||||||
TIM_TimeBaseInit(TIM2, &g_timerInit);
|
|
||||||
|
|
||||||
TIM_ClearFlag(TIM2, TIM_FLAG_Update);
|
|
||||||
TIM_ClearITPendingBit(TIM2, TIM_FLAG_Update);
|
|
||||||
|
|
||||||
TIM_ITConfig(TIM2, TIM_IT_Update, ENABLE);
|
|
||||||
TIM_Cmd(TIM2, ENABLE);
|
|
||||||
}
|
|
||||||
|
|
||||||
void TIM2_IRQHandler(void)
|
|
||||||
{
|
|
||||||
TIM_ClearFlag(TIM2, TIM_FLAG_Update);
|
|
||||||
TIM_ClearITPendingBit(TIM2, TIM_FLAG_Update);
|
|
||||||
|
|
||||||
SleepTimerStop();
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int SleepTimerInit(void)
|
|
||||||
{
|
|
||||||
NVIC_InitTypeDef nvic = { 0 };
|
|
||||||
|
|
||||||
RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2, ENABLE);
|
|
||||||
TIM_TimeBaseStructInit(&g_timerInit);
|
|
||||||
g_timerInit.TIM_Period = SLEEP_TIME_MAX_RESPONSE_TIME;
|
|
||||||
g_timerInit.TIM_Prescaler = 0;
|
|
||||||
TIM_TimeBaseInit(TIM2, &g_timerInit);
|
|
||||||
|
|
||||||
nvic.NVIC_IRQChannel = TIM2_IRQn;
|
|
||||||
nvic.NVIC_IRQChannelPreemptionPriority = TIM2_INI_PRIORITY;
|
|
||||||
nvic.NVIC_IRQChannelSubPriority = 0;
|
|
||||||
nvic.NVIC_IRQChannelCmd = ENABLE;
|
|
||||||
NVIC_Init(&nvic);
|
|
||||||
|
|
||||||
TIM_ClearFlag(TIM2, TIM_FLAG_Update);
|
|
||||||
TIM_ClearITPendingBit(TIM2, TIM_FLAG_Update);
|
|
||||||
#if (LOSCFG_USE_SYSTEM_DEFINED_INTERRUPT == 1)
|
|
||||||
UINT32 ret = HalHwiCreate(TIM2_IRQn, TIM2_INI_PRIORITY, 0, TIM2_IRQHandler, 0);
|
|
||||||
if (ret != LOS_OK) {
|
|
||||||
printf("SleepTimerInit create time2 irq failed! ERROR: 0x%x\n", ret);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return LOS_OK;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*****************************************************************************
|
|
||||||
Function : main
|
|
||||||
Description : Main function entry
|
|
||||||
Input : None
|
|
||||||
Output : None
|
|
||||||
Return : None
|
|
||||||
*****************************************************************************/
|
|
||||||
LITE_OS_SEC_TEXT_INIT int main(void)
|
|
||||||
{
|
|
||||||
unsigned int ret;
|
|
||||||
|
|
||||||
USART_Config();
|
|
||||||
|
|
||||||
printf("\n\rhello world!!\n\r");
|
|
||||||
|
|
||||||
ret = LOS_KernelInit();
|
|
||||||
if (ret == LOS_OK) {
|
|
||||||
#if (LOSCFG_BASE_CORE_SCHED_SLEEP == 1)
|
|
||||||
ret = LOS_SchedSleepInit(SleepTimerInit, SleepTimerStart, SleepTimerStop, GetSleepTimeNs);
|
|
||||||
if (ret != LOS_OK) {
|
|
||||||
goto EXIT;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
TaskSample();
|
|
||||||
LOS_Start();
|
|
||||||
}
|
|
||||||
|
|
||||||
#if (LOSCFG_BASE_CORE_SCHED_SLEEP == 1)
|
|
||||||
EXIT:
|
|
||||||
#endif
|
|
||||||
while (1) {
|
|
||||||
__asm volatile("wfi");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,115 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
|
||||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
|
||||||
* are permitted provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
|
||||||
* conditions and the following disclaimer.
|
|
||||||
*
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
|
||||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
|
||||||
* provided with the distribution.
|
|
||||||
*
|
|
||||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
|
||||||
* to endorse or promote products derived from this software without specific prior written
|
|
||||||
* permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
||||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
|
||||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
||||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
|
||||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
|
||||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**@defgroup los_config System configuration items
|
|
||||||
* @ingroup kernel
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _TARGET_CONFIG_H
|
|
||||||
#define _TARGET_CONFIG_H
|
|
||||||
|
|
||||||
#include "stm32f4xx.h"
|
|
||||||
#include "stm32f4xx_it.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
#if __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
/*=============================================================================
|
|
||||||
System clock module configuration
|
|
||||||
=============================================================================*/
|
|
||||||
#define OS_SYS_CLOCK SystemCoreClock
|
|
||||||
#define LOSCFG_BASE_CORE_TICK_PER_SECOND (1000UL)
|
|
||||||
#define LOSCFG_BASE_CORE_TICK_HW_TIME 0
|
|
||||||
#define LOSCFG_BASE_CORE_TICK_WTIMER 0
|
|
||||||
#define LOSCFG_BASE_CORE_TICK_RESPONSE_MAX SysTick_LOAD_RELOAD_Msk
|
|
||||||
|
|
||||||
/*=============================================================================
|
|
||||||
Hardware interrupt module configuration
|
|
||||||
=============================================================================*/
|
|
||||||
#define LOSCFG_PLATFORM_HWI 1
|
|
||||||
#define LOSCFG_USE_SYSTEM_DEFINED_INTERRUPT 1
|
|
||||||
#define LOSCFG_PLATFORM_HWI_LIMIT 128
|
|
||||||
/*=============================================================================
|
|
||||||
Task module configuration
|
|
||||||
=============================================================================*/
|
|
||||||
#define LOSCFG_BASE_CORE_TSK_LIMIT 24
|
|
||||||
#define LOSCFG_BASE_CORE_TSK_IDLE_STACK_SIZE (0x500U)
|
|
||||||
#define LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE (0x2D0U)
|
|
||||||
#define LOSCFG_BASE_CORE_TSK_MIN_STACK_SIZE (0x130U)
|
|
||||||
#define LOSCFG_BASE_CORE_TIMESLICE 1
|
|
||||||
#define LOSCFG_BASE_CORE_TIMESLICE_TIMEOUT 20000
|
|
||||||
/*=============================================================================
|
|
||||||
Semaphore module configuration
|
|
||||||
=============================================================================*/
|
|
||||||
#define LOSCFG_BASE_IPC_SEM 1
|
|
||||||
#define LOSCFG_BASE_IPC_SEM_LIMIT 48
|
|
||||||
/*=============================================================================
|
|
||||||
Mutex module configuration
|
|
||||||
=============================================================================*/
|
|
||||||
#define LOSCFG_BASE_IPC_MUX 1
|
|
||||||
#define LOSCFG_BASE_IPC_MUX_LIMIT 24
|
|
||||||
/*=============================================================================
|
|
||||||
Queue module configuration
|
|
||||||
=============================================================================*/
|
|
||||||
#define LOSCFG_BASE_IPC_QUEUE 1
|
|
||||||
#define LOSCFG_BASE_IPC_QUEUE_LIMIT 24
|
|
||||||
/*=============================================================================
|
|
||||||
Software timer module configuration
|
|
||||||
=============================================================================*/
|
|
||||||
#define LOSCFG_BASE_CORE_SWTMR 1
|
|
||||||
#define LOSCFG_BASE_CORE_SWTMR_ALIGN 1
|
|
||||||
#define LOSCFG_BASE_CORE_SWTMR_LIMIT 48
|
|
||||||
/*=============================================================================
|
|
||||||
Memory module configuration
|
|
||||||
=============================================================================*/
|
|
||||||
#define LOSCFG_MEM_MUL_POOL 1
|
|
||||||
#define OS_SYS_MEM_NUM 20
|
|
||||||
/*=============================================================================
|
|
||||||
Exception module configuration
|
|
||||||
=============================================================================*/
|
|
||||||
#define LOSCFG_PLATFORM_EXC 1
|
|
||||||
/* =============================================================================
|
|
||||||
printf module configuration
|
|
||||||
============================================================================= */
|
|
||||||
#define LOSCFG_KERNEL_PRINTF 1
|
|
||||||
|
|
||||||
#define LOSCFG_BASE_CORE_SCHED_SLEEP 1
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
#if __cplusplus
|
|
||||||
}
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
#endif /* _TARGET_CONFIG_H */
|
|
|
@ -1,196 +0,0 @@
|
||||||
##########################################################################################################################
|
|
||||||
# File automatically-generated by tool: [projectgenerator] version: [3.11.0-B13] date: [Wed Dec 16 15:17:16 CST 2020]
|
|
||||||
##########################################################################################################################
|
|
||||||
|
|
||||||
# ------------------------------------------------
|
|
||||||
# Generic Makefile (based on gcc)
|
|
||||||
#
|
|
||||||
# ChangeLog :
|
|
||||||
# 2017-02-10 - Several enhancements + project update mode
|
|
||||||
# 2015-07-22 - first version
|
|
||||||
# ------------------------------------------------
|
|
||||||
|
|
||||||
######################################
|
|
||||||
# target
|
|
||||||
######################################
|
|
||||||
TARGET = NUCLEO-F767
|
|
||||||
|
|
||||||
|
|
||||||
######################################
|
|
||||||
# building variables
|
|
||||||
######################################
|
|
||||||
# debug build?
|
|
||||||
DEBUG = 1
|
|
||||||
# optimization
|
|
||||||
OPT = -Og
|
|
||||||
|
|
||||||
|
|
||||||
#######################################
|
|
||||||
# paths
|
|
||||||
#######################################
|
|
||||||
# Build path
|
|
||||||
BUILD_DIR = build
|
|
||||||
|
|
||||||
######################################
|
|
||||||
# source
|
|
||||||
######################################
|
|
||||||
# C sources
|
|
||||||
C_SOURCES = \
|
|
||||||
Core/Src/main.c \
|
|
||||||
Core/Src/stm32f7xx_it.c \
|
|
||||||
Core/Src/stm32f7xx_hal_msp.c \
|
|
||||||
Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_cortex.c \
|
|
||||||
Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_tim.c \
|
|
||||||
Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_tim_ex.c \
|
|
||||||
Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_uart.c \
|
|
||||||
Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_uart_ex.c \
|
|
||||||
Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_rcc.c \
|
|
||||||
Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_rcc_ex.c \
|
|
||||||
Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_flash.c \
|
|
||||||
Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_flash_ex.c \
|
|
||||||
Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_gpio.c \
|
|
||||||
Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_dma.c \
|
|
||||||
Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_dma_ex.c \
|
|
||||||
Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_pwr.c \
|
|
||||||
Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_pwr_ex.c \
|
|
||||||
Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal.c \
|
|
||||||
Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_i2c.c \
|
|
||||||
Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_i2c_ex.c \
|
|
||||||
Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_exti.c \
|
|
||||||
Core/Src/system_stm32f7xx.c
|
|
||||||
|
|
||||||
# ASM sources
|
|
||||||
ASM_SOURCES = \
|
|
||||||
startup_stm32f767xx.s
|
|
||||||
|
|
||||||
|
|
||||||
#######################################
|
|
||||||
# binaries
|
|
||||||
#######################################
|
|
||||||
PREFIX = arm-none-eabi-
|
|
||||||
# The gcc compiler bin path can be either defined in make command via GCC_PATH variable (> make GCC_PATH=xxx)
|
|
||||||
# either it can be added to the PATH environment variable.
|
|
||||||
ifdef GCC_PATH
|
|
||||||
CC = $(GCC_PATH)/$(PREFIX)gcc
|
|
||||||
AS = $(GCC_PATH)/$(PREFIX)gcc -x assembler-with-cpp
|
|
||||||
CP = $(GCC_PATH)/$(PREFIX)objcopy
|
|
||||||
SZ = $(GCC_PATH)/$(PREFIX)size
|
|
||||||
else
|
|
||||||
CC = $(PREFIX)gcc
|
|
||||||
AS = $(PREFIX)gcc -x assembler-with-cpp
|
|
||||||
CP = $(PREFIX)objcopy
|
|
||||||
SZ = $(PREFIX)size
|
|
||||||
endif
|
|
||||||
HEX = $(CP) -O ihex
|
|
||||||
BIN = $(CP) -O binary -S
|
|
||||||
|
|
||||||
#######################################
|
|
||||||
# CFLAGS
|
|
||||||
#######################################
|
|
||||||
# cpu
|
|
||||||
CPU = -mcpu=cortex-m7
|
|
||||||
|
|
||||||
# fpu
|
|
||||||
FPU = -mfpu=fpv5-d16
|
|
||||||
|
|
||||||
# float-abi
|
|
||||||
#FLOAT-ABI = -mfloat-abi=hard
|
|
||||||
FLOAT-ABI = -mfloat-abi=soft
|
|
||||||
|
|
||||||
# mcu
|
|
||||||
MCU = $(CPU) -mthumb $(FPU) $(FLOAT-ABI)
|
|
||||||
|
|
||||||
# macros for gcc
|
|
||||||
# AS defines
|
|
||||||
AS_DEFS =
|
|
||||||
|
|
||||||
# C defines
|
|
||||||
C_DEFS = \
|
|
||||||
-DUSE_HAL_DRIVER \
|
|
||||||
-DSTM32F767xx
|
|
||||||
|
|
||||||
|
|
||||||
# AS includes
|
|
||||||
AS_INCLUDES =
|
|
||||||
|
|
||||||
# C includes
|
|
||||||
C_INCLUDES = \
|
|
||||||
-ICore/Inc \
|
|
||||||
-IDrivers/STM32F7xx_HAL_Driver/Inc \
|
|
||||||
-IDrivers/STM32F7xx_HAL_Driver/Inc/Legacy \
|
|
||||||
-IDrivers/CMSIS/Device/ST/STM32F7xx/Include \
|
|
||||||
-IDrivers/CMSIS/Include \
|
|
||||||
-IDrivers/CMSIS/Include
|
|
||||||
|
|
||||||
|
|
||||||
# compile gcc flags
|
|
||||||
ASFLAGS = $(MCU) $(AS_DEFS) $(AS_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
|
|
||||||
|
|
||||||
CFLAGS = $(MCU) $(C_DEFS) $(C_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
|
|
||||||
|
|
||||||
ifeq ($(DEBUG), 1)
|
|
||||||
CFLAGS += -g -gdwarf-2
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
# Generate dependency information
|
|
||||||
CFLAGS += -MMD -MP -MF"$(@:%.o=%.d)"
|
|
||||||
|
|
||||||
|
|
||||||
#######################################
|
|
||||||
# LDFLAGS
|
|
||||||
#######################################
|
|
||||||
# link script
|
|
||||||
LDSCRIPT = STM32F767ZITx_FLASH.ld
|
|
||||||
|
|
||||||
# libraries
|
|
||||||
LIBS = -lc -lm -lnosys
|
|
||||||
LIBDIR =
|
|
||||||
LDFLAGS = $(MCU) -specs=nano.specs -T$(LDSCRIPT) $(LIBDIR) $(LIBS) -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref -Wl,--gc-sections
|
|
||||||
|
|
||||||
# default action: build all
|
|
||||||
all: $(BUILD_DIR)/$(TARGET).elf $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).bin
|
|
||||||
|
|
||||||
include liteos_m.mk
|
|
||||||
|
|
||||||
#######################################
|
|
||||||
# build the application
|
|
||||||
#######################################
|
|
||||||
# list of objects
|
|
||||||
OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(C_SOURCES:.c=.o)))
|
|
||||||
vpath %.c $(sort $(dir $(C_SOURCES)))
|
|
||||||
# list of ASM program objects
|
|
||||||
OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(ASM_SOURCES:.s=.o)))
|
|
||||||
vpath %.s $(sort $(dir $(ASM_SOURCES)))
|
|
||||||
|
|
||||||
$(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR)
|
|
||||||
$(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@
|
|
||||||
|
|
||||||
$(BUILD_DIR)/%.o: %.s Makefile | $(BUILD_DIR)
|
|
||||||
$(AS) -c $(CFLAGS) $< -o $@
|
|
||||||
|
|
||||||
$(BUILD_DIR)/$(TARGET).elf: $(OBJECTS) Makefile
|
|
||||||
$(CC) $(OBJECTS) $(LDFLAGS) -o $@
|
|
||||||
$(SZ) $@
|
|
||||||
|
|
||||||
$(BUILD_DIR)/%.hex: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
|
|
||||||
$(HEX) $< $@
|
|
||||||
|
|
||||||
$(BUILD_DIR)/%.bin: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
|
|
||||||
$(BIN) $< $@
|
|
||||||
|
|
||||||
$(BUILD_DIR):
|
|
||||||
mkdir $@
|
|
||||||
|
|
||||||
#######################################
|
|
||||||
# clean up
|
|
||||||
#######################################
|
|
||||||
clean:
|
|
||||||
-rm -fR $(BUILD_DIR)
|
|
||||||
|
|
||||||
#######################################
|
|
||||||
# dependencies
|
|
||||||
#######################################
|
|
||||||
-include $(wildcard $(BUILD_DIR)/*.d)
|
|
||||||
|
|
||||||
# *** EOF ***
|
|
|
@ -1,39 +0,0 @@
|
||||||
LITEOSTOPDIR := ../../
|
|
||||||
LITEOSTOPDIR := $(realpath $(LITEOSTOPDIR))
|
|
||||||
|
|
||||||
# Common
|
|
||||||
C_SOURCES += $(wildcard $(LITEOSTOPDIR)/kernel/src/*.c) \
|
|
||||||
$(wildcard $(LITEOSTOPDIR)/kernel/src/mm/*.c) \
|
|
||||||
$(wildcard $(LITEOSTOPDIR)/components/cpup/*.c) \
|
|
||||||
$(wildcard $(LITEOSTOPDIR)/../../third_party/bounds_checking_function/src/*.c) \
|
|
||||||
$(wildcard $(LITEOSTOPDIR)/utils/*.c) \
|
|
||||||
$(wildcard $(LITEOSTOPDIR)/kal/cmsis/*.c) \
|
|
||||||
$(wildcard $(LITEOSTOPDIR)/kal/posix/src/*.c) \
|
|
||||||
Core/Src/task_sample.c
|
|
||||||
|
|
||||||
C_INCLUDES += -I$(LITEOSTOPDIR)/utils \
|
|
||||||
-I$(LITEOSTOPDIR)/kal/cmsis \
|
|
||||||
-I$(LITEOSTOPDIR)/kal/posix/include \
|
|
||||||
-I$(LITEOSTOPDIR)/kernel/include \
|
|
||||||
-I$(LITEOSTOPDIR)/components/cpup \
|
|
||||||
-I$(LITEOSTOPDIR)/../../third_party/bounds_checking_function/include
|
|
||||||
|
|
||||||
# Related to arch
|
|
||||||
ASM_SOURCES += $(wildcard $(LITEOSTOPDIR)/kernel/arch/arm/cortex-m7/gcc/*.s)
|
|
||||||
|
|
||||||
ASMS_SOURCES += $(wildcard $(LITEOSTOPDIR)/kernel/arch/arm/cortex-m7/gcc/*.S)
|
|
||||||
|
|
||||||
C_SOURCES += $(wildcard $(LITEOSTOPDIR)/kernel/arch/arm/cortex-m7/gcc/*.c)
|
|
||||||
|
|
||||||
C_INCLUDES += -I. \
|
|
||||||
-I$(LITEOSTOPDIR)/kernel/arch/include \
|
|
||||||
-I$(LITEOSTOPDIR)/kernel/arch/arm/cortex-m7/gcc
|
|
||||||
|
|
||||||
CFLAGS += -nostdinc -nostdlib
|
|
||||||
|
|
||||||
# list of ASM .S program objects
|
|
||||||
OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(ASMS_SOURCES:.S=.o)))
|
|
||||||
vpath %.S $(sort $(dir $(ASMS_SOURCES)))
|
|
||||||
|
|
||||||
$(BUILD_DIR)/%.o: %.S Makefile | $(BUILD_DIR)
|
|
||||||
$(CC) -c $(CFLAGS) $< -o $@
|
|
|
@ -1,113 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
|
||||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
|
||||||
* are permitted provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
|
||||||
* conditions and the following disclaimer.
|
|
||||||
*
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
|
||||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
|
||||||
* provided with the distribution.
|
|
||||||
*
|
|
||||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
|
||||||
* to endorse or promote products derived from this software without specific prior written
|
|
||||||
* permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
||||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
|
||||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
||||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
|
||||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
|
||||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**@defgroup los_config System configuration items
|
|
||||||
* @ingroup kernel
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _TARGET_CONFIG_H
|
|
||||||
#define _TARGET_CONFIG_H
|
|
||||||
|
|
||||||
#include "stm32f7xx.h"
|
|
||||||
#include "stm32f7xx_it.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
#if __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
/*=============================================================================
|
|
||||||
System clock module configuration
|
|
||||||
=============================================================================*/
|
|
||||||
#define OS_SYS_CLOCK 96000000
|
|
||||||
#define LOSCFG_BASE_CORE_TICK_PER_SECOND (1000UL)
|
|
||||||
#define LOSCFG_BASE_CORE_TICK_HW_TIME 0
|
|
||||||
#define LOSCFG_BASE_CORE_TICK_WTIMER 0
|
|
||||||
#define LOSCFG_BASE_CORE_TICK_RESPONSE_MAX SysTick_LOAD_RELOAD_Msk
|
|
||||||
|
|
||||||
/*=============================================================================
|
|
||||||
Hardware interrupt module configuration
|
|
||||||
=============================================================================*/
|
|
||||||
#define LOSCFG_PLATFORM_HWI 1
|
|
||||||
#define LOSCFG_PLATFORM_HWI_LIMIT 128
|
|
||||||
/*=============================================================================
|
|
||||||
Task module configuration
|
|
||||||
=============================================================================*/
|
|
||||||
#define LOSCFG_BASE_CORE_TSK_LIMIT 24
|
|
||||||
#define LOSCFG_BASE_CORE_TSK_IDLE_STACK_SIZE (0x500U)
|
|
||||||
#define LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE (0x2D0U)
|
|
||||||
#define LOSCFG_BASE_CORE_TSK_MIN_STACK_SIZE (0x130U)
|
|
||||||
#define LOSCFG_BASE_CORE_TIMESLICE 1
|
|
||||||
#define LOSCFG_BASE_CORE_TIMESLICE_TIMEOUT 20000
|
|
||||||
/*=============================================================================
|
|
||||||
Semaphore module configuration
|
|
||||||
=============================================================================*/
|
|
||||||
#define LOSCFG_BASE_IPC_SEM 1
|
|
||||||
#define LOSCFG_BASE_IPC_SEM_LIMIT 48
|
|
||||||
/*=============================================================================
|
|
||||||
Mutex module configuration
|
|
||||||
=============================================================================*/
|
|
||||||
#define LOSCFG_BASE_IPC_MUX 1
|
|
||||||
#define LOSCFG_BASE_IPC_MUX_LIMIT 24
|
|
||||||
/*=============================================================================
|
|
||||||
Queue module configuration
|
|
||||||
=============================================================================*/
|
|
||||||
#define LOSCFG_BASE_IPC_QUEUE 1
|
|
||||||
#define LOSCFG_BASE_IPC_QUEUE_LIMIT 24
|
|
||||||
/*=============================================================================
|
|
||||||
Software timer module configuration
|
|
||||||
=============================================================================*/
|
|
||||||
#define LOSCFG_BASE_CORE_SWTMR 1
|
|
||||||
#define LOSCFG_BASE_CORE_SWTMR_ALIGN 1
|
|
||||||
#define LOSCFG_BASE_CORE_SWTMR_LIMIT 48
|
|
||||||
/*=============================================================================
|
|
||||||
Memory module configuration
|
|
||||||
=============================================================================*/
|
|
||||||
#define OS_SYS_MEM_SIZE 0x00013000
|
|
||||||
#define LOSCFG_BASE_MEM_NODE_INTEGRITY_CHECK 0
|
|
||||||
#define LOSCFG_BASE_MEM_NODE_SIZE_CHECK 1
|
|
||||||
#define LOSCFG_MEM_MUL_POOL 1
|
|
||||||
#define OS_SYS_MEM_NUM 20
|
|
||||||
#define LOSCFG_KERNEL_MEM_SLAB 0
|
|
||||||
/*=============================================================================
|
|
||||||
Exception module configuration
|
|
||||||
=============================================================================*/
|
|
||||||
#define LOSCFG_PLATFORM_EXC 0
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
#if __cplusplus
|
|
||||||
}
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* _TARGET_CONFIG_H */
|
|
Loading…
Reference in New Issue