]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1_GCC/freedom-metal/doc/sphinx/devguide/itim.rst
Base project to replace existing Freedom Studio project using latest Freedom Studio...
[freertos] / FreeRTOS / Demo / RISC-V_RV32_SiFive_HiFive1_GCC / freedom-metal / doc / sphinx / devguide / itim.rst
1 Instruction Tightly Integrated Memory
2 =====================================
3
4 The Instruction Tightly Integrated Memory (ITIM) is an optional feature
5 on certain SiFive RISC-V CPUs. The ITIM is a memory device which is
6 optimized in the CoreIP memory heirarchy to provide low-latency
7 access to instruction memory.
8
9 Freedom Metal provides the ability to designate functions to run out of
10 the ITIM by decorating the functions with the following "decorator":
11
12 .. doxygendefine:: METAL_PLACE_IN_ITIM
13    :project: metal
14
15 For example:
16
17 .. code-block:: C
18
19    METAL_PLACE_IN_ITIM
20    void my_itim_func() {
21       /* This code will run out of the ITIM */
22    }
23
24 Caveats
25 -------
26 The ``METAL_PLACE_IN_ITIM`` decorator tells the toolchain to link the
27 decorated function into the ITIM memory. However, compiler optimizations
28 such as function inlining may cause execution to never transfer to
29 instructions fetched from the ITIM.
30
31 If this compiler optimization is not desired, one workaround is to
32 tell the compiler to not inline the function:
33
34 .. code-block:: C
35
36    __attribute__((noinline))
37    METAL_PLACE_IN_ITIM
38    void my_itim_func() {
39       /* This code will run out of the ITIM */
40    }
41