diff --git a/pxtcompiler/emitter/hexfile.ts b/pxtcompiler/emitter/hexfile.ts index ec2571b98b36..3d9c7fde8627 100644 --- a/pxtcompiler/emitter/hexfile.ts +++ b/pxtcompiler/emitter/hexfile.ts @@ -1019,9 +1019,11 @@ ${hexfile.hexPrelude()} let b = mkProcessorFile(target) b.emit(src); + let flashUsableEnd = target.flashUsableEnd ? target.flashUsableEnd : target.flashEnd + src = `; Interface tables: ${bin.itFullEntries}/${bin.itEntries} (${Math.round(100 * bin.itFullEntries / bin.itEntries)}%)\n` + `; Virtual methods: ${bin.numVirtMethods} / ${bin.numMethods}\n` + - b.getSource(!peepDbg, bin.numStmts, target.flashUsableEnd); + b.getSource(!peepDbg, bin.numStmts, flashUsableEnd); throwAssemblerErrors(b) diff --git a/pxtlib/emitter/assembler.ts b/pxtlib/emitter/assembler.ts index 2815c25f4a98..0b0ad3f4e694 100644 --- a/pxtlib/emitter/assembler.ts +++ b/pxtlib/emitter/assembler.ts @@ -1084,7 +1084,7 @@ namespace ts.pxtc.assembler { let totalEnd = (lenTotal + this.baseOffset - 1) & 0xffffff if (flashUsableEnd && totalEnd >= flashUsableEnd) { - const e = new Error(lf("program too big by {0} bytes!", totalEnd - flashUsableEnd)); + const e = new Error(lf("program too big by {0} bytes!", totalEnd - flashUsableEnd + 1)); (e as any).ksErrorCode = 9283; throw e; }