修复代码错误

This commit is contained in:
nhkefus
2025-03-11 14:10:51 +08:00
parent a7f6e9379a
commit 3422912129
576 changed files with 39303 additions and 1012 deletions

0
mico-os/CHANGELOG.txt Normal file → Executable file
View File

View File

@@ -15,12 +15,8 @@ VERSION := 8.2.0
$(NAME)_SOURCES := ver$(VERSION)/Source/portable/MemMang/heap_4.c
else
VERSION := 9.0.0
ifneq ($(filter $(HOST_MCU_FAMILY),MOC108),)
$(NAME)_SOURCES := ver$(VERSION)/Source/portable/MemMang/heap_4.c
else
$(NAME)_SOURCES := ver$(VERSION)/Source/portable/MemMang/heap_3.c
endif
endif
VERSION_MAJOR = $(word 1, $(subst ., ,$(VERSION)))
VERSION_MINOR = $(word 2, $(subst ., ,$(VERSION)))
@@ -75,9 +71,6 @@ Cortex-M4F_SOURCES := ver$(VERSION)/Source/portable/GCC/ARM_CM4F/port.c
Cortex-M4F_INCLUDES := ver$(VERSION)/Source/portable/GCC/ARM_CM4F
endif
ARM968E-S_SOURCES := ver$(VERSION)/Source/portable/GCC/ARM968E_S/port.c
ARM968E-S_INCLUDES := ver$(VERSION)/Source/portable/GCC/ARM968E_S
$(NAME)_SOURCES += $($(HOST_ARCH)_SOURCES)
GLOBAL_INCLUDES += $($(HOST_ARCH)_INCLUDES)

View File

@@ -163,19 +163,9 @@ int main( void )
return 0;
}
WEAK void mico_main(void)
{
}
static void application_thread_main( void *arg )
{
UNUSED_PARAMETER( arg );
/* Initialize after rtos is in initialized */
mico_main();
mico_rtos_init();
if ( MicoShouldEnterMFGMode( ) )
mico_system_qc_test( );
else
@@ -856,19 +846,6 @@ void vApplicationMallocFailedHook( void )
}
#if FreeRTOS_VERSION_MAJOR > 7
void rtos_suppress_and_sleep( unsigned long sleep_ms )
{
TickType_t missed_ticks = 0;
extern uint32_t platform_power_down_hook( unsigned long sleep_ms );
missed_ticks = platform_power_down_hook( sleep_ms );
vTaskStepTick( missed_ticks );
}
#endif
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@@ -518,6 +518,9 @@ xTimeOutType xTimeOut;
{
traceQUEUE_SEND( pxQueue );
prvCopyDataToQueue( pxQueue, pvItemToQueue, xCopyPosition );
#ifdef MXCHIP
event_rx_cb(pxQueue);
#endif
/* If there was a task waiting for data to arrive on the
queue then unblock it now. */
if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToReceive ) ) == pdFALSE )
@@ -533,9 +536,6 @@ xTimeOutType xTimeOut;
}
taskEXIT_CRITICAL();
#ifdef MXCHIP
event_rx_cb(pxQueue);
#endif
/* Return to the original privilege level before exiting the
function. */

View File

View File

View File

View File

View File

View File

View File

@@ -643,7 +643,9 @@ Queue_t * const pxQueue = ( Queue_t * ) xQueue;
{
traceQUEUE_SEND( pxQueue );
xYieldRequired = prvCopyDataToQueue( pxQueue, pvItemToQueue, xCopyPosition );
#ifdef MXCHIP
event_rx_cb(pxQueue);
#endif
#if ( configUSE_QUEUE_SETS == 1 )
{
if( pxQueue->pxQueueSetContainer != NULL )
@@ -728,9 +730,6 @@ Queue_t * const pxQueue = ( Queue_t * ) xQueue;
#endif /* configUSE_QUEUE_SETS */
taskEXIT_CRITICAL();
#ifdef MXCHIP
event_rx_cb(pxQueue);
#endif
return pdPASS;
}
else

0
mico-os/MiCO/RTOS/FreeRTOS/ver8.2.0/Source/readme.txt Normal file → Executable file
View File

View File

@@ -98,9 +98,7 @@
#define configUSE_TIMERS ( 1 )
#define configTIMER_TASK_PRIORITY ( 2 )
#define configTIMER_QUEUE_LENGTH ( 5 )
#ifndef configTIMER_TASK_STACK_DEPTH
#define configTIMER_TASK_STACK_DEPTH ( ( unsigned short ) (1024 / sizeof( portSTACK_TYPE )) )
#endif
/* Task */
#define configMAX_PRIORITIES ( 10 )
@@ -110,12 +108,6 @@
#define configIDLE_SHOULD_YIELD 1
#define configUSE_CO_ROUTINES 0
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
#ifndef configUSE_TICKLESS_IDLE
#define configUSE_TICKLESS_IDLE (1)
#endif
extern void rtos_suppress_and_sleep( unsigned long sleep_ms );
#define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime ) rtos_suppress_and_sleep( xExpectedIdleTime )
/* Hooks */
#define configUSE_IDLE_HOOK 0
@@ -123,9 +115,7 @@ extern void rtos_suppress_and_sleep( unsigned long sleep_ms );
#define configUSE_MALLOC_FAILED_HOOK ( 1 )
/* Memory */
#ifndef configTOTAL_HEAP_SIZE
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 18 * 1024 ) )
#endif
/* Queue & Semaphore & Mutex */
#define configQUEUE_REGISTRY_SIZE 0

View File

@@ -76,7 +76,6 @@
* memory management pages of http://www.FreeRTOS.org for more information.
*/
#include <stdlib.h>
#include <string.h>
/* Defining MPU_WRAPPERS_INCLUDED_FROM_API_FILE prevents task.h from redefining
all the API functions to use the MPU wrappers. That should only be done when
@@ -98,12 +97,6 @@ task.h is included from an application file. */
/* Assumes 8bit bytes! */
#define heapBITS_PER_BYTE ( ( size_t ) 8 )
#if CONFIG_USE_LINKER_HEAP
extern void *_heap_start;
extern void *_heap_end;
extern void *_heap_len;
#else
/* Allocate the memory for the heap. */
#if( configAPPLICATION_ALLOCATED_HEAP == 1 )
/* The application writer has already defined the array used for the RTOS
@@ -112,7 +105,6 @@ extern void *_heap_len;
#else
static uint8_t ucHeap[ configTOTAL_HEAP_SIZE ];
#endif /* configAPPLICATION_ALLOCATED_HEAP */
#endif
/* Define the linked list structure. This is used to link free blocks in order
of their memory address. */
@@ -160,11 +152,12 @@ static size_t xBlockAllocatedBit = 0;
/*-----------------------------------------------------------*/
static void *malloc_without_lock( size_t xWantedSize )
void *pvPortMalloc( size_t xWantedSize )
{
BlockLink_t *pxBlock, *pxPreviousBlock, *pxNewBlockLink;
void *pvReturn = NULL;
vTaskSuspendAll();
{
/* If this is the first call to malloc then the heap will require
initialisation to setup the list of free blocks. */
@@ -288,6 +281,7 @@ void *pvReturn = NULL;
traceMALLOC( pvReturn, xWantedSize );
}
( void ) xTaskResumeAll();
#if( configUSE_MALLOC_FAILED_HOOK == 1 )
{
@@ -306,21 +300,6 @@ void *pvReturn = NULL;
configASSERT( ( ( ( size_t ) pvReturn ) & ( size_t ) portBYTE_ALIGNMENT_MASK ) == 0 );
return pvReturn;
}
void *pvPortMalloc( size_t xWantedSize )
{
void *pvReturn = NULL;
if (xWantedSize == 0)
xWantedSize = 4;
vTaskSuspendAll();
pvReturn = malloc_without_lock(xWantedSize);
( void ) xTaskResumeAll();
return pvReturn;
}
/*-----------------------------------------------------------*/
void vPortFree( void *pv )
@@ -388,56 +367,7 @@ void vPortInitialiseBlocks( void )
/* This just exists to keep the linker quiet. */
}
/*-----------------------------------------------------------*/
#if CONFIG_USE_LINKER_HEAP
static void prvHeapInit( void )
{
BlockLink_t *pxFirstFreeBlock;
uint8_t *pucAlignedHeap;
size_t uxAddress;
size_t xTotalHeapSize = (size_t)&_heap_len;
/* Ensure the heap starts on a correctly aligned boundary. */
uxAddress = ( size_t ) &_heap_start;
if( ( uxAddress & portBYTE_ALIGNMENT_MASK ) != 0 )
{
uxAddress += ( portBYTE_ALIGNMENT - 1 );
uxAddress &= ~( ( size_t ) portBYTE_ALIGNMENT_MASK );
xTotalHeapSize -= uxAddress - ( size_t ) &_heap_start;
}
pucAlignedHeap = ( uint8_t * ) uxAddress;
/* xStart is used to hold a pointer to the first item in the list of free
blocks. The void cast is used to prevent compiler warnings. */
xStart.pxNextFreeBlock = ( void * ) pucAlignedHeap;
xStart.xBlockSize = ( size_t ) 0;
/* pxEnd is used to mark the end of the list of free blocks and is inserted
at the end of the heap space. */
uxAddress = ( ( size_t ) pucAlignedHeap ) + xTotalHeapSize;
uxAddress -= xHeapStructSize;
uxAddress &= ~( ( size_t ) portBYTE_ALIGNMENT_MASK );
pxEnd = ( void * ) uxAddress;
pxEnd->xBlockSize = 0;
pxEnd->pxNextFreeBlock = NULL;
/* To start with there is a single free block that is sized to take up the
entire heap space, minus the space taken by pxEnd. */
pxFirstFreeBlock = ( void * ) pucAlignedHeap;
pxFirstFreeBlock->xBlockSize = uxAddress - ( size_t ) pxFirstFreeBlock;
pxFirstFreeBlock->pxNextFreeBlock = pxEnd;
/* Only one block exists - and it covers the entire usable heap space. */
xMinimumEverFreeBytesRemaining = pxFirstFreeBlock->xBlockSize;
xFreeBytesRemaining = pxFirstFreeBlock->xBlockSize;
/* Work out the position of the top bit in a size_t variable. */
xBlockAllocatedBit = ( ( size_t ) 1 ) << ( ( sizeof( size_t ) * heapBITS_PER_BYTE ) - 1 );
}
#else
static void prvHeapInit( void )
{
BlockLink_t *pxFirstFreeBlock;
@@ -484,7 +414,6 @@ size_t xTotalHeapSize = configTOTAL_HEAP_SIZE;
/* Work out the position of the top bit in a size_t variable. */
xBlockAllocatedBit = ( ( size_t ) 1 ) << ( ( sizeof( size_t ) * heapBITS_PER_BYTE ) - 1 );
}
#endif
/*-----------------------------------------------------------*/
static void prvInsertBlockIntoFreeList( BlockLink_t *pxBlockToInsert )
@@ -547,115 +476,3 @@ uint8_t *puc;
}
}
/*yhb added 2015-08-13*/
void *pvPortRealloc( void *pv, size_t xWantedSize )
{
uint8_t *puc = ( uint8_t * ) pv;
BlockLink_t *pxLink;
int presize, datasize;
void *pvReturn = NULL;
BlockLink_t *pxIterator, *pxPreviousBlock, *tmp;
if (pv == NULL)
return pvPortMalloc(xWantedSize);
/* The memory being freed will have an BlockLink_t structure immediately
before it. */
puc -= xHeapStructSize;
/* This casting is to keep the compiler from issuing warnings. */
pxLink = ( void * ) puc;
presize = (pxLink->xBlockSize & ~xBlockAllocatedBit);
datasize = presize - xHeapStructSize;
if (datasize >= xWantedSize) // have enough memory don't need realloc
return pv;
pxLink->xBlockSize &= ~xBlockAllocatedBit;
vTaskSuspendAll();
/* Add this block to the list of free blocks. */
xFreeBytesRemaining += pxLink->xBlockSize;
prvInsertBlockIntoFreeList( ( ( BlockLink_t * ) pxLink ) );
pvReturn = malloc_without_lock(xWantedSize);
if (pvReturn != NULL) {
if (pvReturn != pv)
memcpy(pvReturn, pv, datasize);
} else { // if can't realloc such big memory, we should NOT put pv in free list.
//ll_printf("realloc FIX!!\r\n");
pxPreviousBlock = &xStart;
pxIterator = xStart.pxNextFreeBlock;
while( pxIterator != NULL )
{
if (pxIterator > pxLink) {
break;
}
if (pxIterator == pxLink) {// find pxLink at the begin
if (pxIterator->xBlockSize > presize) {
tmp = (BlockLink_t *)((uint8_t*)pxLink + presize);
tmp->xBlockSize = (pxIterator->xBlockSize - presize);
tmp->pxNextFreeBlock = pxIterator->pxNextFreeBlock;
pxPreviousBlock->pxNextFreeBlock = tmp;
} else {
pxPreviousBlock->pxNextFreeBlock = pxIterator->pxNextFreeBlock;
}
goto INSERTED;
}
if ((uint8_t*)pxIterator+pxIterator->xBlockSize == (uint8_t*)pxLink + presize) { // find pxLink at the end
pxIterator->xBlockSize -= presize;
goto INSERTED;
}
if ((uint8_t*)pxIterator+pxIterator->xBlockSize > (uint8_t*)pxLink + presize) { // find pxLink in the middle
pxPreviousBlock = pxIterator;
pxIterator = (BlockLink_t *)((uint8_t*)pxLink + presize);
pxIterator->xBlockSize = ((uint8_t*)pxPreviousBlock+pxPreviousBlock->xBlockSize)-
((uint8_t*)pxLink + presize);
tmp = pxPreviousBlock->pxNextFreeBlock;
pxPreviousBlock->pxNextFreeBlock = pxIterator;
pxPreviousBlock->xBlockSize = (uint8_t*)pxLink - (uint8_t*)pxPreviousBlock;
pxIterator->pxNextFreeBlock = tmp;
goto INSERTED;
}
pxPreviousBlock = pxIterator;
pxIterator = pxIterator->pxNextFreeBlock;
}
INSERTED:
pxLink->xBlockSize = presize|xBlockAllocatedBit;;
pxLink->pxNextFreeBlock = NULL;
xFreeBytesRemaining -= presize;
}
( void ) xTaskResumeAll();
return pvReturn;
}
#if CONFIG_USE_LINKER_HEAP
int heap_total_size(void)
{
return (int)&_heap_len;
}
#else
int heap_total_size(void)
{
return configTOTAL_HEAP_SIZE;
}
#endif
int vPortGetBlocks(void)
{
int blocks = 1;
BlockLink_t *pxIterator;
pxIterator = &xStart;
/* Iterate through the list until a block is found that has a higher address
than the block being inserted. */
while( pxIterator->pxNextFreeBlock)
{
blocks++;
pxIterator = pxIterator->pxNextFreeBlock;
}
return blocks;
}

View File

@@ -753,7 +753,9 @@ Queue_t * const pxQueue = ( Queue_t * ) xQueue;
{
traceQUEUE_SEND( pxQueue );
xYieldRequired = prvCopyDataToQueue( pxQueue, pvItemToQueue, xCopyPosition );
#ifdef MXCHIP
event_rx_cb(pxQueue);
#endif
#if ( configUSE_QUEUE_SETS == 1 )
{
if( pxQueue->pxQueueSetContainer != NULL )
@@ -838,9 +840,6 @@ Queue_t * const pxQueue = ( Queue_t * ) xQueue;
#endif /* configUSE_QUEUE_SETS */
taskEXIT_CRITICAL();
#ifdef MXCHIP
event_rx_cb(pxQueue);
#endif
return pdPASS;
}
else

View File

@@ -15,17 +15,5 @@ GLOBAL_INCLUDES := .
$(NAME)_SOURCES := rtos.c
Cortex-M3_SOURCES :=
Cortex-M3_INCLUDES := portable/GCC/ARM_CM
Cortex-M4_SOURCES :=
Cortex-M4_INCLUDES := portable/GCC/ARM_CM
Cortex-M4F_SOURCES :=
Cortex-M4F_INCLUDES := portable/GCC/ARM_CM
ARM968E-S_SOURCES := portable/GCC/ARM968E_S/port.c
ARM968E-S_INCLUDES := portable/GCC/ARM968E_S
$(NAME)_SOURCES += $($(HOST_ARCH)_SOURCES)
GLOBAL_INCLUDES += $($(HOST_ARCH)_INCLUDES)

View File

@@ -21,12 +21,14 @@
#include "common.h"
#include "platform_peripheral.h"
#include "portmacro.h"
/******************************************************
* Macros
******************************************************/
#define DISABLE_INTERRUPTS() do { __asm("CPSID i"); } while (0)
#define ENABLE_INTERRUPTS() do { __asm("CPSIE i"); } while (0)
/******************************************************
* Constants
******************************************************/
@@ -68,13 +70,6 @@ typedef volatile struct _noos_mutex_t
* Variable Definitions
******************************************************/
#ifdef MICO_DEFAULT_TICK_RATE_HZ
uint32_t ms_to_tick_ratio = (uint32_t)( 1000 / MICO_DEFAULT_TICK_RATE_HZ );
#else
uint32_t ms_to_tick_ratio = 1; // Default OS tick is 1000Hz
#endif
uint8_t semaphore_pool_init = 0;
noos_semaphore_t semaphore_pool[SEMAPHORE_POOL_NUM];
@@ -256,8 +251,7 @@ extern uint32_t mico_get_time_no_os(void);
mico_time_t mico_rtos_get_time(void)
{
uint32_t tick = mico_get_time_no_os( );
return ms_to_tick_ratio * tick;
return mico_get_time_no_os( );
}
/**

View File

@@ -208,6 +208,7 @@ OSStatus mico_rtos_deregister_timed_event( mico_timed_event_t* event_object )
return kGeneralErr;
}
memset( event_object, 0, sizeof( *event_object ) );
return kNoErr;
}

0
mico-os/MiCO/RTOS/mico_rtos_common.h Normal file → Executable file
View File

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -132,7 +132,6 @@ USED const user_api_t user_handler = {
#ifdef CONFIG_CPU_MX1290
.pinmaps = &peripherals_pinmap,
.gpio_init = gpio_init,
.stdio_break_in = 1, // 1=enable: bootloader use user uart to enter boot mode.
#endif
};

View File

@@ -9,15 +9,11 @@
NAME := LwIP
ifneq ($(filter $(HOST_MCU_FAMILY),MOC108),)
VERSION := 2.0.2
else
ifneq ($(filter $(HOST_MCU_FAMILY),MTK7697),)
VERSION := 1.5.0
else
VERSION := 1.4.0.rc1
endif
endif
VERSION_MAJOR = $(word 1, $(subst ., ,$(VERSION)))
VERSION_MINOR = $(word 2, $(subst ., ,$(VERSION)))

View File

@@ -42,8 +42,6 @@
extern "C" {
#endif
#define LWIP_NO_STDINT_H 1
typedef uint8_t u8_t;
typedef int8_t s8_t;
typedef uint16_t u16_t;
@@ -84,8 +82,6 @@ typedef int sys_prot_t;
/* Select how LwIP debug will print */
#define LWIP_PLATFORM_DIAG(x) {printf x;}
#define LWIP_DONT_PROVIDE_BYTEORDER_FUNCTIONS
#ifdef MICO_LWIP_DEBUG
#define LWIP_PLATFORM_ASSERT(x) MICO_ASSERTION_FAIL_ACTION()
#else

0
mico-os/MiCO/net/LwIP/ver1.5.0/CHANGELOG Normal file → Executable file
View File

0
mico-os/MiCO/net/LwIP/ver1.5.0/COPYING Normal file → Executable file
View File

0
mico-os/MiCO/net/LwIP/ver1.5.0/FILES Normal file → Executable file
View File

0
mico-os/MiCO/net/LwIP/ver1.5.0/README Normal file → Executable file
View File

0
mico-os/MiCO/net/LwIP/ver1.5.0/UPGRADING Normal file → Executable file
View File

0
mico-os/MiCO/net/LwIP/ver1.5.0/doc/FILES Normal file → Executable file
View File

0
mico-os/MiCO/net/LwIP/ver1.5.0/doc/contrib.txt Normal file → Executable file
View File

0
mico-os/MiCO/net/LwIP/ver1.5.0/doc/ppp.txt Normal file → Executable file
View File

0
mico-os/MiCO/net/LwIP/ver1.5.0/doc/rawapi.txt Normal file → Executable file
View File

0
mico-os/MiCO/net/LwIP/ver1.5.0/doc/savannah.txt Normal file → Executable file
View File

0
mico-os/MiCO/net/LwIP/ver1.5.0/doc/snmp_agent.txt Normal file → Executable file
View File

0
mico-os/MiCO/net/LwIP/ver1.5.0/doc/sys_arch.txt Normal file → Executable file
View File

0
mico-os/MiCO/net/LwIP/ver1.5.0/src/FILES Normal file → Executable file
View File

0
mico-os/MiCO/net/LwIP/ver1.5.0/src/include/lwip/api.h Normal file → Executable file
View File

View File

0
mico-os/MiCO/net/LwIP/ver1.5.0/src/include/lwip/arch.h Normal file → Executable file
View File

View File

0
mico-os/MiCO/net/LwIP/ver1.5.0/src/include/lwip/def.h Normal file → Executable file
View File

0
mico-os/MiCO/net/LwIP/ver1.5.0/src/include/lwip/dhcp.h Normal file → Executable file
View File

View File

0
mico-os/MiCO/net/LwIP/ver1.5.0/src/include/lwip/dns.h Normal file → Executable file
View File

0
mico-os/MiCO/net/LwIP/ver1.5.0/src/include/lwip/err.h Normal file → Executable file
View File

View File

0
mico-os/MiCO/net/LwIP/ver1.5.0/src/include/lwip/icmp.h Normal file → Executable file
View File

View File

0
mico-os/MiCO/net/LwIP/ver1.5.0/src/include/lwip/igmp.h Normal file → Executable file
View File

0
mico-os/MiCO/net/LwIP/ver1.5.0/src/include/lwip/inet.h Normal file → Executable file
View File

View File

0
mico-os/MiCO/net/LwIP/ver1.5.0/src/include/lwip/init.h Normal file → Executable file
View File

0
mico-os/MiCO/net/LwIP/ver1.5.0/src/include/lwip/ip.h Normal file → Executable file
View File

0
mico-os/MiCO/net/LwIP/ver1.5.0/src/include/lwip/ip4.h Normal file → Executable file
View File

View File

0
mico-os/MiCO/net/LwIP/ver1.5.0/src/include/lwip/ip6.h Normal file → Executable file
View File

View File

View File

View File

View File

0
mico-os/MiCO/net/LwIP/ver1.5.0/src/include/lwip/mem.h Normal file → Executable file
View File

0
mico-os/MiCO/net/LwIP/ver1.5.0/src/include/lwip/memp.h Normal file → Executable file
View File

View File

0
mico-os/MiCO/net/LwIP/ver1.5.0/src/include/lwip/mld6.h Normal file → Executable file
View File

0
mico-os/MiCO/net/LwIP/ver1.5.0/src/include/lwip/nd6.h Normal file → Executable file
View File

View File

View File

View File

View File

0
mico-os/MiCO/net/LwIP/ver1.5.0/src/include/lwip/opt.h Normal file → Executable file
View File

0
mico-os/MiCO/net/LwIP/ver1.5.0/src/include/lwip/pbuf.h Normal file → Executable file
View File

View File

Some files were not shown because too many files have changed in this diff Show More