Implemented malloc lock.
This commit is contained in:
parent
56aab11a7e
commit
6019146984
|
@ -18,6 +18,7 @@ set(TARGET_LDSCRIPT_RAM "${CMAKE_SOURCE_DIR}/STM32H750VBTx_RAM.ld")
|
|||
set(TARGET_C_SOURCES
|
||||
"Core/Src/freertos.c"
|
||||
"Core/Src/libc-hooks.c"
|
||||
"Core/Src/libc-lock.c"
|
||||
"Core/Src/main.c"
|
||||
"Core/Src/stm32h7xx_it.c"
|
||||
"Core/Src/stm32h7xx_hal_msp.c"
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
extern UART_HandleTypeDef huart1;
|
||||
|
||||
/* Place heap inside DTCMRAM. */
|
||||
/* Place heap inside D2 SRAM. */
|
||||
#define HEAP_BASE 0x30000000
|
||||
#define HEAP_SIZE 0x00048000
|
||||
|
||||
|
@ -51,7 +51,6 @@ int _lseek(int file, int ptr, int dir){
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* TODO: This is NOT thread-safe. */
|
||||
void *_sbrk(intptr_t count) {
|
||||
void *ret, *ptr;
|
||||
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
#ifndef __SINGLE_THREAD__
|
||||
#include "cmsis_os.h"
|
||||
|
||||
// TODO: This implementation is not suitable for malloc in ISRs.
|
||||
|
||||
void __malloc_lock(struct _reent *r) {
|
||||
(void)r;
|
||||
taskENTER_CRITICAL();
|
||||
}
|
||||
|
||||
|
||||
void __malloc_unlock(struct _reent *r) {
|
||||
(void)r;
|
||||
taskEXIT_CRITICAL();
|
||||
}
|
||||
|
||||
#endif /* !defined(__SINGLE_THREAD__) */
|
|
@ -360,6 +360,12 @@ static void report_heap(void) {
|
|||
printf("\r\nHeap usage: %d bytes.\r\n", mi.uordblks);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Load a script called boot.rb from SD card
|
||||
* It's caller free.
|
||||
*
|
||||
* @return char* string contains script.
|
||||
*/
|
||||
static char *load_boot_script(void) {
|
||||
if(f_mount(&SDFatFS, SDPath, 1) != FR_OK) {
|
||||
printf("FS mount failed.\r\n");
|
||||
|
@ -396,6 +402,7 @@ out_close:
|
|||
f_close(&boot_file);
|
||||
|
||||
out_umount:
|
||||
/* Unmount filesystem by passing NULL to drive path. */
|
||||
f_mount(NULL, SDPath, 0);
|
||||
|
||||
return ret;
|
||||
|
|
|
@ -201,7 +201,7 @@ ProjectManager.StackSize=0x400
|
|||
ProjectManager.TargetToolchain=Makefile
|
||||
ProjectManager.ToolChainLocation=
|
||||
ProjectManager.UnderRoot=false
|
||||
ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-SystemClock_Config-RCC-false-HAL-false,3-MX_USART1_UART_Init-USART1-false-HAL-true,4-MX_SDMMC1_SD_Init-SDMMC1-false-HAL-true,5-MX_MDMA_Init-MDMA-false-HAL-true,5-MX_FATFS_Init-FATFS-false-HAL-false,0-MX_CORTEX_M7_Init-CORTEX_M7-false-HAL-true
|
||||
ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-SystemClock_Config-RCC-false-HAL-false,3-MX_USART1_UART_Init-USART1-false-HAL-true,4-MX_SDMMC1_SD_Init-SDMMC1-false-HAL-true,5-MX_FATFS_Init-FATFS-false-HAL-false,0-MX_CORTEX_M7_Init-CORTEX_M7-false-HAL-true
|
||||
RCC.ADCFreq_Value=16125000
|
||||
RCC.AHB12Freq_Value=50000000
|
||||
RCC.AHB4Freq_Value=50000000
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
cmake_minimum_required(VERSION 3.10)
|
||||
|
||||
project(linenoise)
|
||||
|
||||
set(LINENOISE_SOURCES
|
||||
"linenoise/linenoise.c"
|
||||
)
|
||||
|
||||
set(LINENOISE_INCLUDES
|
||||
"linenoise"
|
||||
)
|
||||
|
||||
add_library(${PROJECT_NAME} ${LINENOISE_SOURCES})
|
||||
target_include_directories(${PROJECT_NAME} PUBLIC ${LINENOISE_INCLUDES})
|
|
@ -1 +1 @@
|
|||
Subproject commit 69b1667b5ba4d245c76d1cb99f2c813eae78b3e9
|
||||
Subproject commit 6f2efebbb9e0d43ca471d89ea76f396baa43eb62
|
Loading…
Reference in New Issue