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

ITCM for "user" code #737

merged 4 commits into from
Jan 6, 2022

Conversation

Daft-Freak
Copy link
Collaborator

Allows use of ITCM in things that aren't the firmware (which doesn't use any of it).

  • Adds the init code to user_startup
  • Splits ITCM roughly in half (because of the API/ITCMISR sections the game gets 30k and the firmware gets 4+28+2k)
  • Adds some macros for marking "fast"/in-memory functions (similar to the not_in_flash stuff from the Pico SDK... also uses that for pico)

Slightly silly minimal test:

void blit_no_inline_fast_code(itcm_print)() {
  debugf("Hello from ITCM!\n");
}

(Covers most of the cases that used to fail before the tools stuff)

Something more impressive:

diff --git a/lua/lvm.c b/lua/lvm.c
index aa3b22b..2a97521 100644
--- a/lua/lvm.c
+++ b/lua/lvm.c
@@ -1118,8 +1118,8 @@ void luaV_finishOp (lua_State *L) {
 #define vmcase(l)	case l:
 #define vmbreak		break
 
-
-void luaV_execute (lua_State *L, CallInfo *ci) {
+#include "engine/fast_code.hpp"
+void blit_fast_code(luaV_execute) (lua_State *L, CallInfo *ci) {
   LClosure *cl;
   TValue *k;
   StkId base;

Gets some basic usage working at least
Roughly 50/50 split. (4+28+2k/30k)
Stuff like .itcm.some_func, so we can have working --gc-sections
Inspired by the "not in flash" macros from the pico sdk (and the pico support uses those)
@Gadgetoid Gadgetoid merged commit e1c4538 into 32blit:master Jan 6, 2022
@Gadgetoid
Copy link
Contributor

The Lua tweaks built, but I need to look into why on earth they didn't run. PEBKAC error, probably!

Either way this is an immensely exciting change that - based on your Lua build - could really make Lua and some other things viable.

Thank you!

@Daft-Freak Daft-Freak deleted the user-itcm branch January 6, 2022 15:14
Gadgetoid added a commit to 32blit/32blit-lua that referenced this pull request Jan 27, 2022
Take advantage of the new ITCM RAM support to dramatically speed up the Lua VM.

See: 32blit/32blit-sdk#737

Co-authored-by: Charlie Birks <[email protected]>
Gadgetoid added a commit to 32blit/32blit-lua that referenced this pull request Jan 27, 2022
Take advantage of the new ITCM RAM support to dramatically speed up the Lua VM.

See: 32blit/32blit-sdk#737

Co-authored-by: Charlie Birks <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants