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

Commit 8f49ecd

Browse files
committed
temp
1 parent 89dd96f commit 8f49ecd

7 files changed

Lines changed: 18 additions & 17 deletions

File tree

src/Makefile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ FIRMWARE = $(BUILD)/firmware
1212
# include py core make definitions
1313
include $(TOP)/py/py.mk
1414

15-
# TODO: common CROSS_COMPILE required
16-
CROSS_COMPILE = /opt/gcc-arm-none-eabi-7-2018-q2-update/bin/arm-none-eabi-
17-
# CROSS_COMPILE = arm-none-eabi-
15+
CROSS_COMPILE = arm-none-eabi-
1816

1917
INC += -I.
2018
INC += -I$(TOP)
@@ -27,7 +25,6 @@ CFLAGS_MCU_m0 = $(CFLAGS_CORTEX_M) -mtune=cortex-m0 -mcpu=cortex-m0 -mfloat-abi=
2725
CFLAGS = $(INC) -Wall -Werror -std=c99 -nostdlib $(CFLAGS_MCU_m0) $(COPT)
2826
CFLAGS += -DMP_CONFIGFILE="<mpconfigport.h>"
2927
CFLAGS += -DMPACK_HAS_CONFIG=1
30-
CFLAGS += -fno-jump-tables
3128

3229
# when MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE = 1
3330
MPY_CROSS_FLAGS += -mcache-lookup-bc
@@ -39,6 +36,7 @@ else
3936
CFLAGS += -Os -DNDEBUG
4037
endif
4138

39+
4240
LDFLAGS = -nostdlib -T openpie.ld -Map=$@.map --cref
4341
LIBS = $(shell $(CC) $(CFLAGS) -print-libgcc-file-name)
4442

src/build.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
1-
import os
2-
import sys
3-
import time
1+
import shutil
42
import traceback
5-
from collections import Container
63
from pathlib import Path
74
from subprocess import check_call, DEVNULL, CalledProcessError
8-
from typing import TypeVar, Generic
5+
from typing import TypeVar, Generic, Container
96

107
from dataclasses import dataclass
118
from elftools.elf.elffile import ELFFile
129
from elftools.elf.sections import SymbolTableSection, Section, Symbol
13-
import shutil
1410

1511
FOLDER = Path(__file__).parent
1612
OPMOD_PATH = FOLDER.parent / "opmod"

src/machine.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,17 @@ void Reset_Handler(void) {
3232
__asm volatile ("mov sp, r1");
3333

3434
// copy .data section from flash to RAM
35-
for (uint32_t *src = &_sidata, *dest = &_sdata; dest < &_edata;) {
36-
*dest++ = *src++;
35+
if (__syscall3(SYS_CONTROL_INIT_COPY, (int) &_sidata, (int) &_sdata, (int) &_edata) == 0) {
36+
for (uint32_t *src = &_sidata, *dest = &_sdata; dest < &_edata;) {
37+
*dest++ = *src++;
38+
}
3739
}
3840

3941
// zero out .bss section
40-
for (uint32_t *dest = &_sbss; dest < &_ebss;) {
41-
*dest++ = 0;
42+
if (__syscall2(SYS_CONTROL_INIT_ZERO, (int) &_sbss, (int) &_ebss) == 0) {
43+
for (uint32_t *dest = &_sbss; dest < &_ebss;) {
44+
*dest++ = 0;
45+
}
4246
}
4347

4448
// OPENPIE_CONTROLLER->PENDING = (uint32_t) &MP_STATE_VM(mp_pending_exception);

src/main.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ int main(int argc, char **argv) {
6767
mp_obj_list_append(mp_sys_path, MP_OBJ_NEW_QSTR(MP_QSTR_));
6868
mp_obj_list_init(mp_sys_argv, 0);
6969

70+
do_str("from pystone import main; main(2000)", MP_PARSE_FILE_INPUT);
71+
__syscall0(0xDEADBEEF);
72+
7073
do_frozen("bios.py");
7174

7275
for (;;) {

src/modules/bios.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ def get_component(t):
2424
2525
2626
filesystems = components("filesystem")
27-
print(filesystems)
2827
def check_bootable(address):
2928
return address and address in filesystems and invoke(address, 'exists', init)
3029
@@ -44,7 +43,6 @@ def load(address):
4443
content = b"".join(buffer)
4544
return content.decode()
4645
47-
4846
def main():
4947
address = invoke(__path__, 'getData').decode()
5048
if not check_bootable(address):

src/openpie.ld

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
/* Specify the memory areas */
66
MEMORY
77
{
8-
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 256K
8+
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 512K
99
SRAM (rw) : ORIGIN = 0x20000000, LENGTH = 64K
1010
RAM (rw) : ORIGIN = 0x60000000, LENGTH = 192K
1111
}

src/syscall_table.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
#define SYS_CONTROL_REBOOT (SYS_CONTROL | 2)
66
#define SYS_CONTROL_CRASH (SYS_CONTROL | 3)
77
#define SYS_CONTROL_RETURN (SYS_CONTROL | 4)
8+
#define SYS_CONTROL_INIT_COPY (SYS_CONTROL | 16)
9+
#define SYS_CONTROL_INIT_ZERO (SYS_CONTROL | 17)
810

911
#define SYS_SIGNAL (0x030000)
1012
#define SYS_SIGNAL_REQUEST (SYS_SIGNAL | 1)

0 commit comments

Comments
 (0)