Skip to content
This repository was archived by the owner on Apr 25, 2021. It is now read-only.

Commit 32e3dbd

Browse files
committed
OpenPython 아키텍쳐가 아니면 에러가 나도록 EEPROM, opos를 고침
https://oc.cil.li/index.php?/topic/921-architecture-tagging-for-eeproms-feedback-requested/
1 parent 88d05a8 commit 32e3dbd

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

src/build.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,17 @@ def build(folder: Path = FOLDER, target_folder: Path = TARGET_FOLDER):
144144
shutil.copyfile(str(build_path / "firmware.bin"), str(target_folder / "firmware.bin"))
145145
shutil.copyfile(str(build_path / "firmware.elf"), str(target_folder / "firmware.elf"))
146146
shutil.copyfile(str(build_path / "firmware.elf.map"), str(target_folder / "firmware.elf.map"))
147-
shutil.copyfile(str(folder / "eeprom.py"), str(target_folder / "eeprom.py"))
147+
148+
rom: Path = folder / "eeprom.py"
149+
text = rom.read_text()
150+
if text.startswith("# --"):
151+
text = text[len("# "):]
152+
else:
153+
raise Exception("eeprom missing magic tag")
154+
155+
target_rom = (target_folder / "eeprom.py")
156+
target_rom.write_text(text)
157+
148158
print(target_folder / "firmware.bin")
149159

150160

src/eeprom.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
#!micropython
1+
# --[==[
2+
"""OpenPython EEPROM"""
23

34

45
def main():
@@ -58,3 +59,5 @@ def load(address):
5859

5960
if __name__ == '__main__':
6061
main()
62+
63+
# ]==] error "This EEPROM requires a CPU running the OpenPython architecture."

src/modules/bios.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,12 @@ def load(address):
7373
main()
7474
""")
7575

76+
comment = b"--[==[", b"]==]"
77+
7678
data = invoke(eeprom, 'get')
79+
if data.startswith(comment[0]) and comment[1] in data:
80+
data = data[len(comment[0]):].partition(comment[1])[0]
81+
7782
context = {'__name__': '__main__', '__path__': eeprom}
7883

7984
func = compile(data, "<EEPROM>", "exec")

0 commit comments

Comments
 (0)