Skip to content

Commit

Permalink
fix iwram persistence
Browse files Browse the repository at this point in the history
  • Loading branch information
velipso committed Sep 11, 2023
1 parent 5268b11 commit 8634d5c
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2493,7 +2493,8 @@ export class Import {
if (ewram - 0x02000000 > 256 * 1024) {
throw new CompError(struct.flp, 'Out of memory for static allocation in EWRAM');
}
memory = { iwram, ewram };
memory.iwram = iwram;
memory.ewram = ewram;
} else {
const baseAddr = bases[0].addr;
const sects = await section.flatten(bases[0], memory, length);
Expand Down
35 changes: 35 additions & 0 deletions src/itests/memory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,41 @@ export function load(def: (test: ITest) => void) {
.struct baz = ewram
.i8 data
.end
`,
},
});

def({
name: 'memory.multiple-files',
desc: 'Memory allocation across disparate files',
kind: 'make',
stdout: [
'one = 03000000',
'two = 03000004',
'three = 0300000c',
],
files: {
'/root/main': `
.import './two' { two }
.import './three' { three }
.struct one = iwram
.i32 one
.end
.include './two'
.include './three'
.printf "one = %08x", one
.printf "two = %08x", two
.printf "three = %08x", three
`,
'/root/two': `
.struct two = iwram
.i32 two[2]
.end
`,
'/root/three': `
.struct three = iwram
.i32 three[3]
.end
`,
},
});
Expand Down
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { IItestArgs, itest } from './itest.ts';
import { argParse, Path } from './deps.ts';
import { ILexKeyValue, lexKeyValue } from './lexer.ts';

export const version = 2003000;
export const version = 2003001;

function printVersion() {
const vmaj = Math.floor(version / 1000000) % 1000;
Expand Down

0 comments on commit 8634d5c

Please sign in to comment.