xref: /Kernel-v10.6.2/include/newlib-freertos.h (revision ef7b253b56c9788077f5ecd6c9deb4021923d646)
1 /*
2  * FreeRTOS Kernel V10.6.2
3  * Copyright (C) 2021 Amazon.com, Inc. or its affiliates.  All Rights Reserved.
4  *
5  * SPDX-License-Identifier: MIT
6  *
7  * Permission is hereby granted, free of charge, to any person obtaining a copy of
8  * this software and associated documentation files (the "Software"), to deal in
9  * the Software without restriction, including without limitation the rights to
10  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11  * the Software, and to permit persons to whom the Software is furnished to do so,
12  * subject to the following conditions:
13  *
14  * The above copyright notice and this permission notice shall be included in all
15  * copies or substantial portions of the Software.
16  *
17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23  *
24  * https://www.FreeRTOS.org
25  * https://github.com/FreeRTOS
26  *
27  */
28 
29 #ifndef INC_NEWLIB_FREERTOS_H
30 #define INC_NEWLIB_FREERTOS_H
31 
32 /* Note Newlib support has been included by popular demand, but is not
33  * used by the FreeRTOS maintainers themselves.  FreeRTOS is not
34  * responsible for resulting newlib operation.  User must be familiar with
35  * newlib and must provide system-wide implementations of the necessary
36  * stubs. Be warned that (at the time of writing) the current newlib design
37  * implements a system-wide malloc() that must be provided with locks.
38  *
39  * See the third party link http://www.nadler.com/embedded/newlibAndFreeRTOS.html
40  * for additional information. */
41 
42 #include <reent.h>
43 
44 #define configUSE_C_RUNTIME_TLS_SUPPORT    1
45 
46 #ifndef configTLS_BLOCK_TYPE
47     #define configTLS_BLOCK_TYPE           struct _reent
48 #endif
49 
50 #ifndef configINIT_TLS_BLOCK
51     #define configINIT_TLS_BLOCK( xTLSBlock, pxTopOfStack )    _REENT_INIT_PTR( &( xTLSBlock ) )
52 #endif
53 
54 #ifndef configSET_TLS_BLOCK
55     #define configSET_TLS_BLOCK( xTLSBlock )    ( _impure_ptr = &( xTLSBlock ) )
56 #endif
57 
58 #ifndef configDEINIT_TLS_BLOCK
59     #define configDEINIT_TLS_BLOCK( xTLSBlock )    _reclaim_reent( &( xTLSBlock ) )
60 #endif
61 
62 #endif /* INC_NEWLIB_FREERTOS_H */
63