-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from microbit-foundation/new-device
Add support for MicroPython for the new micro:bit
- Loading branch information
Showing
20 changed files
with
54,904 additions
and
519 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/** | ||
* (c) 2019 Micro:bit Educational Foundation and the microbit-fs contributors. | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
import * as fs from 'fs'; | ||
|
||
import * as flashRegions from '../flash-regions'; | ||
|
||
describe('Read MicroPython UICR data.', () => { | ||
const uPyHexFile = fs.readFileSync( | ||
'./src/__tests__/upy-v2-beta-region.hex', | ||
'utf8' | ||
); | ||
|
||
it('Read MicroPython v2-beta-region hex file flash regions table', () => { | ||
const expectedPageSize = 4096; | ||
const expectedFlashSize = 512 * 1024; | ||
const MicroPythonLastByteUsed = 0x61f24; | ||
const expectedRuntimeEndPage = Math.ceil( | ||
MicroPythonLastByteUsed / expectedPageSize | ||
); | ||
const expectedFsStartAddress = 0x6d000; | ||
const expectedFsEndAddress = 0x73000; | ||
const expectedUpyVersion = | ||
'micro:bit v2.0.99+b260810 on 2020-11-17; ' + | ||
'MicroPython b260810 on 2020-11-17'; | ||
|
||
const result = flashRegions.getIntelHexFlashRegionsData(uPyHexFile); | ||
|
||
expect(result.flashPageSize).toEqual(expectedPageSize); | ||
expect(result.flashSize).toEqual(expectedFlashSize); | ||
expect(result.flashStartAddress).toEqual(0); | ||
expect(result.flashEndAddress).toEqual(expectedFlashSize); | ||
expect(result.runtimeStartAddress).toEqual(0); | ||
expect(result.runtimeEndAddress).toEqual( | ||
expectedRuntimeEndPage * expectedPageSize | ||
); | ||
expect(result.fsStartAddress).toEqual(expectedFsStartAddress); | ||
expect(result.fsEndAddress).toEqual(expectedFsEndAddress); | ||
expect(result.uPyVersion).toEqual(expectedUpyVersion); | ||
expect(result.deviceVersion).toEqual(2); | ||
}); | ||
}); |
Oops, something went wrong.