Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ITCM for "user" code #737

Merged
merged 4 commits into from
Jan 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion 32blit-stm32/STM32H750VBTx.ld
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ FRAMEBUFFER (rw) : ORIGIN = 0x3000FC00, LENGTH = 225K
RAM_D3 (xrw) : ORIGIN = 0x38000000, LENGTH = 64K
PERSIST (rw) : ORIGIN = 0x38800000, LENGTH = 4K
ITCMISR (xrw) : ORIGIN = 0x00000000, LENGTH = 4K
ITCMRAM (xrw) : ORIGIN = 0x00001000, LENGTH = 58K
ITCMRAM (xrw) : ORIGIN = DEFINED(FLASH_TARGET_INT) ? 0x00001000 : 0x00008000,
LENGTH = DEFINED(FLASH_TARGET_INT) ? 28K : 30K

MAIN_RAM (xrw) : ORIGIN = DEFINED(FLASH_TARGET_INT) ? 0x30000000 : 0x24000000,
LENGTH = DEFINED(FLASH_TARGET_INT) ? 63K : 362K
Expand Down Expand Up @@ -185,6 +186,7 @@ SECTIONS
. = ALIGN(4);
itcm_text_start = .;
*(.itcm) /* ITCM code section */
*(.itcm*)
. = ALIGN(4);
itcm_text_end = .;
} >ITCMRAM AT> FLASH
Expand Down
19 changes: 18 additions & 1 deletion 32blit-stm32/startup_user.s
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,23 @@ LoopCopyDataInit:
cmp r2, r3
bcc CopyDataInit

// Copy ITCM
movs r1, #0
b LoopCopyITCMInit
CopyITCMInit:
ldr r3, =itcm_data
add r3, r4
ldr r3, [r3, r1]
str r3, [r0, r1]
adds r1, r1, #4

LoopCopyITCMInit:
ldr r0, =itcm_text_start
ldr r3, =itcm_text_end
adds r2, r0, r1
cmp r2, r3
bcc CopyITCMInit

ldr r2, =_sbss
b LoopFillZerobss

Expand Down Expand Up @@ -124,4 +141,4 @@ g_pfnVectors:

.weak init
.thumb_set init,main
*/
*/
1 change: 1 addition & 0 deletions 32blit/32blit.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "audio/mp3-stream.hpp"
#include "engine/api.hpp"
#include "engine/engine.hpp"
#include "engine/fast_code.hpp"
#include "engine/file.hpp"
#include "engine/input.hpp"
#include "engine/menu.hpp"
Expand Down
14 changes: 14 additions & 0 deletions 32blit/engine/fast_code.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#pragma once

#ifdef TARGET_32BLIT_HW
#define blit_fast_code(fn) __attribute__((section(".itcm." #fn))) fn
#define blit_no_inline_fast_code(fn) __attribute__((noinline)) blit_fast_code(fn)
#elif defined(PICO_BUILD)
#include <pico/platform.h>

#define blit_fast_code(fn) __not_in_flash_func(fn)
#define blit_no_inline_fast_code(fn) __no_inline_not_in_flash_func(fn)
#else
#define blit_fast_code(fn) fn
#define blit_no_inline_fast_code(fn) fn
#endif