qemu-arm: Add license and copyright to files missing them.
All of these files are first-party code written from scratch as part of
this repository, and were added when the top-level MIT license was active,
so they have an MIT license by default. Tracing back the git history show
the original authors/source/copyright as follows:
- main.c, mpconfigport.h: copied from the bare-arm port [1].
- test_main.c: added in [2].
- mphalport.h: added in [3] then updated in [4].
- mps2.ld, nrf51.ld, stm32.ld, uart.h: added in [4].
- imx6.ld, uart.c, startup.c: added in [4] and updated in [5].
[1] Commit c55721582282f282d33e35e458a2944890210ebc in 2014, the initial
bare-arm port; see related ee857853d60a135685c5088e5492dfe6e8a5acb0.
[2] Commit c1c32d65af038ba1b2a2a8dd69e3f7e63eac5f3e in 2014, initial
qemu-arm CI tests.
[3] Commit b0a15aa73540f82ef47c9492af7ce196d1b1a6e9 in 2016, enabling
extmods and their tests.
[4] Commit e7332b05841549a41614e522285639dcaa7bd526 in 2018, big refactor.
[5] Commit b84406f3133a36a703a1506d754fc046dd955922 in 2021, adding
Cortex-A9 support.
Signed-off-by: Damien George <damien@micropython.org>
2024-06-11 12:13:37 +10:00
|
|
|
/*
|
|
|
|
|
* This file is part of the MicroPython project, http://micropython.org/
|
|
|
|
|
*
|
|
|
|
|
* The MIT License (MIT)
|
|
|
|
|
*
|
|
|
|
|
* Copyright (c) 2014-2023 Damien P. George
|
|
|
|
|
*
|
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
|
* of this software and associated documentation files (the "Software"), to deal
|
|
|
|
|
* in the Software without restriction, including without limitation the rights
|
|
|
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
|
* copies of the Software, and to permit persons to whom the Software is
|
|
|
|
|
* furnished to do so, subject to the following conditions:
|
|
|
|
|
*
|
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
|
* all copies or substantial portions of the Software.
|
|
|
|
|
*
|
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
|
* THE SOFTWARE.
|
|
|
|
|
*/
|
|
|
|
|
|
2017-02-16 17:23:06 +11:00
|
|
|
#include <stdlib.h>
|
2014-04-16 17:27:23 +01:00
|
|
|
|
2015-01-01 21:15:38 +00:00
|
|
|
#include "py/compile.h"
|
|
|
|
|
#include "py/runtime.h"
|
2015-01-08 21:40:35 +00:00
|
|
|
#include "py/stackctrl.h"
|
2015-01-12 12:07:42 +00:00
|
|
|
#include "py/gc.h"
|
2017-03-14 11:25:52 +11:00
|
|
|
#include "py/mperrno.h"
|
2024-08-12 11:32:28 +10:00
|
|
|
#include "shared/runtime/gchelper.h"
|
|
|
|
|
#include "shared/runtime/pyexec.h"
|
2014-04-16 17:27:23 +01:00
|
|
|
|
2024-08-12 11:32:28 +10:00
|
|
|
#define HEAP_SIZE (100 * 1024)
|
|
|
|
|
|
|
|
|
|
static uint32_t gc_heap[HEAP_SIZE / sizeof(uint32_t)];
|
2014-04-16 17:27:23 +01:00
|
|
|
|
2014-04-21 21:00:23 +01:00
|
|
|
int main(int argc, char **argv) {
|
2016-01-29 01:05:53 +02:00
|
|
|
mp_stack_ctrl_init();
|
2015-01-08 21:40:35 +00:00
|
|
|
mp_stack_set_limit(10240);
|
2024-08-12 11:32:28 +10:00
|
|
|
gc_init(gc_heap, (char *)gc_heap + HEAP_SIZE);
|
|
|
|
|
|
|
|
|
|
for (;;) {
|
|
|
|
|
mp_init();
|
|
|
|
|
|
|
|
|
|
for (;;) {
|
|
|
|
|
if (pyexec_mode_kind == PYEXEC_MODE_RAW_REPL) {
|
|
|
|
|
if (pyexec_raw_repl() != 0) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (pyexec_friendly_repl() != 0) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mp_printf(&mp_plat_print, "MPY: soft reboot\n");
|
|
|
|
|
|
|
|
|
|
gc_sweep_all();
|
|
|
|
|
mp_deinit();
|
|
|
|
|
}
|
2014-04-16 17:27:23 +01:00
|
|
|
}
|
|
|
|
|
|
2014-04-21 21:00:23 +01:00
|
|
|
void gc_collect(void) {
|
2024-08-12 11:32:28 +10:00
|
|
|
gc_collect_start();
|
|
|
|
|
gc_helper_collect_regs_and_stack();
|
|
|
|
|
gc_collect_end();
|
2014-04-16 17:27:23 +01:00
|
|
|
}
|
|
|
|
|
|
2023-09-27 13:43:50 +10:00
|
|
|
mp_lexer_t *mp_lexer_new_from_file(qstr filename) {
|
2017-03-14 11:25:52 +11:00
|
|
|
mp_raise_OSError(MP_ENOENT);
|
2014-04-16 17:27:23 +01:00
|
|
|
}
|
|
|
|
|
|
2014-04-21 21:00:23 +01:00
|
|
|
void nlr_jump_fail(void *val) {
|
2024-08-12 11:32:28 +10:00
|
|
|
mp_printf(&mp_plat_print, "uncaught NLR\n");
|
2017-02-16 17:23:06 +11:00
|
|
|
exit(1);
|
2014-04-16 17:27:23 +01:00
|
|
|
}
|