Commit 5c422de0 by Michael Schmid

works OK with 3 cores -> spinlock problems

parent 41f038e0
......@@ -17,7 +17,7 @@ SET(CMAKE_CXX_COMPILER C:/HighTec/toolchains/tricore/v4.6.6.0-infineon-1.1/bin/t
SET(CMAKE_FIND_ROOT_PATH C:/HighTec/toolchains/tricore/v4.6.6.0-infineon-1.1)
# path to FreeRTOS
SET(FREE_RTOS_LIB_PATH C:/Data/Projekte/FreeRTOS_TC27x)
SET(FREE_RTOS_LIB_PATH C:/Data/Projekte/FreeRTOS_AppKit_TC277)
# search for programs in the build host directories
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
......
......@@ -127,7 +127,7 @@ void embb_core_set_init(embb_core_set_t* core_set, int initializer) {
#ifdef EMBB_PLATFORM_THREADING_RTOSTASKS
#ifdef __TriCore__
#define CORE_COUNT 2 //scm34681: 3
#define CORE_COUNT 3 //scm34681: 3
#endif
......
......@@ -44,8 +44,11 @@ enum {
void* embb_alloc(size_t bytes) {
size_t bytes_to_allocate = 2 * sizeof(size_t)+bytes;
#ifdef EMBB_OS_FREERTOS
void* allocated = pvPortMalloc(bytes_to_allocate);
#else
void* allocated = malloc(bytes_to_allocate);
#endif
if (allocated == NULL)
return NULL;
......@@ -74,8 +77,11 @@ void embb_free(void * ptr) {
embb_atomic_fetch_and_add_long(
&embb_bytes_allocated, (long)(0 - (size_t)(*bytes_allocated)));
#ifdef EMBB_OS_FREERTOS
vPortFree((size_t*)ptr - 2);
#else
free((size_t*)ptr - 2);
#endif
}
void* embb_alloc_aligned(size_t alignment, size_t size) {
......@@ -97,8 +103,11 @@ void* embb_alloc_aligned(size_t alignment, size_t size) {
size_t additional_bytes = sizeof(size_t) * 3;
size_t bytes_to_allocate = (n + 1)*alignment + (additional_bytes - 1);
#ifdef EMBB_OS_FREERTOS
char* allocated = (char *)pvPortMalloc(bytes_to_allocate);
#else
char* allocated = (char *)malloc(bytes_to_allocate);
#endif
if (allocated == NULL)
return NULL;
......@@ -146,8 +155,11 @@ void embb_free_aligned(void* ptr) {
embb_atomic_fetch_and_add_long(
&embb_bytes_allocated, (long)((long)0 - ptr_conv[-3]));
#ifdef EMBB_OS_FREERTOS
vPortFree((void*)ptr_conv[-2]);
#else
free((void*)ptr_conv[-2]);
#endif
}
size_t embb_get_bytes_allocated() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment