Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
FORMUS3IC_LAS3
/
embb
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
ac1d3297
authored
8 years ago
by
Michael Schmid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
small changes, mostly because of new compiler version
parent
1e369a58
embb_freertos
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
20 additions
and
13 deletions
+20
-13
CMakeCommon/SetCompilerFlags.cmake
+1
-1
TC_Toolchain.cmake
+1
-1
base_c/include/embb/base/c/internal/atomic/compare_and_swap.h
+6
-3
base_c/include/embb/base/c/internal/atomic/fetch_and_add.h
+5
-5
base_c/include/embb/base/c/internal/atomic/swap.h
+4
-1
base_c/src/memory_allocation.c
+3
-2
base_c/src/mutex.c
+0
-0
No files found.
CMakeCommon/SetCompilerFlags.cmake
View file @
ac1d3297
...
...
@@ -29,7 +29,7 @@ function(SetGNUCompilerFlags compiler_libs)
if
(
DEFINED __TriCore__
)
set
(
compiler_libs PARENT_SCOPE
)
set
(
common_c_flags
"-fno-common -Os -std=c99"
)
set
(
common_cxx_flags
"-fno-common -std=c++0
x
"
)
set
(
common_cxx_flags
"-fno-common -std=c++0
3
"
)
set
(
warning_flags
"-W -Wall -Wextra"
)
set
(
target_flags
"-DAPPKIT_TC277TFT -DEMBB_DEBUG -fshort-double -mcpu=tc27xx -mversion-info"
)
if
(
WARNINGS_ARE_ERRORS STREQUAL ON
)
...
...
This diff is collapsed.
Click to expand it.
TC_Toolchain.cmake
View file @
ac1d3297
...
...
@@ -15,7 +15,7 @@ SET(CMAKE_C_COMPILER C:/HighTec/toolchains/tricore/v4.9.1.0-infineon-1.1/bin/t
SET
(
CMAKE_CXX_COMPILER C:/HighTec/toolchains/tricore/v4.9.1.0-infineon-1.1/bin/tricore-c++.exe
)
# target environment
SET
(
CMAKE_FIND_ROOT_PATH C:/HighTec/toolchains/tricore/v4.
6.6
.0-infineon-1.1
)
SET
(
CMAKE_FIND_ROOT_PATH C:/HighTec/toolchains/tricore/v4.
9.1
.0-infineon-1.1
)
# path to FreeRTOS
SET
(
FREE_RTOS_LIB_PATH C:/Data/Projekte/FreeRTOS_AppKit_TC277
)
...
...
This diff is collapsed.
Click to expand it.
base_c/include/embb/base/c/internal/atomic/compare_and_swap.h
View file @
ac1d3297
...
...
@@ -136,7 +136,7 @@ EMBB_DEFINE_COMPARE_AND_SWAP(4, "")
register uint64_t e_reg = desired; \
__asm__ __volatile__ ("dsync\n\t" \
"ld.w %H0, [%3]0\n\t" \
"cmpswap
.w
[%2]0, %A0\n\t" \
"cmpswap
" EMBB_ATOMIC_TC_SIZE_SUFFIX "
[%2]0, %A0\n\t" \
"eq %[result], %H0, %L0" \
: "+d"(e_reg), [result]"=&d" (result) \
: "a"(pointer_to_value), "a"(expected) \
...
...
@@ -147,10 +147,13 @@ EMBB_DEFINE_COMPARE_AND_SWAP(4, "")
#error "No atomic fetch and store implementation found"
#endif
//TODO: CAS-byte and CAS-short not needed yet, implement if needed
/*
* CAS instruction is only available for word-size.
* This macro will fail to build, once swap is needed for byte or halfwords.
*/
EMBB_DEFINE_COMPARE_AND_SWAP
(
1
,
".b"
)
EMBB_DEFINE_COMPARE_AND_SWAP
(
2
,
".h"
)
EMBB_DEFINE_COMPARE_AND_SWAP
(
4
,
""
)
EMBB_DEFINE_COMPARE_AND_SWAP
(
4
,
"
.w
"
)
#else
#error "Unknown architecture"
...
...
This diff is collapsed.
Click to expand it.
base_c/include/embb/base/c/internal/atomic/fetch_and_add.h
View file @
ac1d3297
...
...
@@ -124,21 +124,21 @@ EMBB_DEFINE_FETCH_AND_ADD(4, "")
EMBB_PLATFORM_INLINE EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) EMBB_CAT2(embb_internal__atomic_fetch_and_add_, EMBB_PARAMETER_SIZE_BYTE) \
(EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) volatile* pointer_to_value, EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) new_value) { \
EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) result; \
register uint64_t e_reg = sizeof(
value) == sizeof(uint32_t) ? (uint64_t)
value : 0ull; \
register uint64_t e_reg = sizeof(
new_value) == sizeof(uint32_t) ? (uint64_t)new_
value : 0ull; \
register uint32_t add = (uint32_t)pointer_to_value & 0xFFFFFFFC; \
uint32_t pos = ((uint32_t)pointer_to_value & 0x3) * 8; \
uint32_t width = sizeof(
value) == sizeof(uint32_t) ? 31 : sizeof(
value) * 8; \
uint32_t width = sizeof(
new_value) == sizeof(uint32_t) ? 31 : sizeof(new_
value) * 8; \
register uint64_t e_mask = ((uint64_t)width << 32) | pos; \
__asm__ __volatile__ ("dsync\n\t" \
"mov.a %[pointer_to_value], %[add]\n\t" \
"loop_%=:\tld.w %H0, [%3]0\n\t" \
"insert %L0, %L0, %[value], %A1\n\t" \
"insert %L0, %L0, %[
new_
value], %A1\n\t" \
"add" EMBB_ATOMIC_TC_SIZE_SUFFIX " %L0, %L0, %H0\n\t" \
"cmpswap.w [%3]0, %A0\n\t" \
"jne %H0, %L0, loop_%=\n\t" \
"extr
.u
%[result], %H0, %A1" \
"extr %[result], %H0, %A1" \
: "+d"(e_reg), [e_mask]"+d"(e_mask), [result] "=&d" (result) \
: [pointer_to_value]"a"(pointer_to_value), [
value] "r" (
value), [add] "d" (add) \
: [pointer_to_value]"a"(pointer_to_value), [
new_value] "r" (new_
value), [add] "d" (add) \
: "memory"); \
return result; \
}
...
...
This diff is collapsed.
Click to expand it.
base_c/include/embb/base/c/internal/atomic/swap.h
View file @
ac1d3297
...
...
@@ -125,7 +125,10 @@ EMBB_DEFINE_SWAP(4, "")
: "memory"); \
return new_value; \
}
/*
* Swap instruction is only available for word-size.
* This macro will fail to build, once swap is needed for byte or halfwords.
*/
#else
#error "No atomic fetch and store implementation found"
#endif
...
...
This diff is collapsed.
Click to expand it.
base_c/src/memory_allocation.c
View file @
ac1d3297
...
...
@@ -191,11 +191,12 @@ void *embb_alloc_aligned(size_t alignment, size_t size) {
malloc_addr
=
_aligned_malloc
(
size
,
alignment
);
#elif defined EMBB_PLATFORM_COMPILER_GNUC
#ifdef __TRICORE__
#error Enable EMBB_DEBUG-Flag for TriCore
/*
* The TriCore Toolchain uses
obsolete
function memalign() for
* The TriCore Toolchain uses function memalign() for
* aligned memory allocation.
*/
#include <malloc.h>
// scm3681: rework
#include <malloc.h>
malloc_addr
=
memalign
(
alignment
,
size
);
#else
/* __TRICORE__ */
/*
...
...
This diff is collapsed.
Click to expand it.
base_c/src/mutex.c
View file @
ac1d3297
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment