Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

litex: remove minimal build option #2768

Merged
merged 5 commits into from
Apr 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions ports/litex/common-hal/os/__init__.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2020 Sean Cross
*
* 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.
*/

#include "genhdr/mpversion.h"
#include "py/mpconfig.h"
#include "py/objstr.h"
#include "py/objtuple.h"
#include "py/qstr.h"

STATIC const qstr os_uname_info_fields[] = {
MP_QSTR_sysname, MP_QSTR_nodename,
MP_QSTR_release, MP_QSTR_version, MP_QSTR_machine
};
STATIC const MP_DEFINE_STR_OBJ(os_uname_info_sysname_obj, "litex");
STATIC const MP_DEFINE_STR_OBJ(os_uname_info_nodename_obj, "litex");
STATIC const MP_DEFINE_STR_OBJ(os_uname_info_release_obj, MICROPY_VERSION_STRING);
STATIC const MP_DEFINE_STR_OBJ(os_uname_info_version_obj, MICROPY_GIT_TAG " on " MICROPY_BUILD_DATE);
STATIC const MP_DEFINE_STR_OBJ(os_uname_info_machine_obj, MICROPY_HW_BOARD_NAME " with " MICROPY_HW_MCU_NAME);


STATIC MP_DEFINE_ATTRTUPLE(
os_uname_info_obj,
os_uname_info_fields,
5,
(mp_obj_t)&os_uname_info_sysname_obj,
(mp_obj_t)&os_uname_info_nodename_obj,
(mp_obj_t)&os_uname_info_release_obj,
(mp_obj_t)&os_uname_info_version_obj,
(mp_obj_t)&os_uname_info_machine_obj
);

mp_obj_t common_hal_os_uname(void) {
return (mp_obj_t)&os_uname_info_obj;
}

bool common_hal_os_urandom(uint8_t* buffer, uint32_t length) {
return false;
}
5 changes: 4 additions & 1 deletion ports/litex/mpconfigport.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,12 @@
#ifndef FPGA_MPCONFIGPORT_H__
#define FPGA_MPCONFIGPORT_H__

#define MICROPY_PY_UJSON (0)
#define CIRCUITPY_INTERNAL_NVM_SIZE (0)
#define MICROPY_NLR_THUMB (0)
#define MICROPY_PY_COLLECTIONS_ORDEREDDICT (1)
#define MICROPY_PY_REVERSE_SPECIAL_METHODS (1)
#define MICROPY_PY_UBINASCII (1)
#define MICROPY_PY_UJSON (1)

#include "py/circuitpy_mpconfig.h"

Expand Down
28 changes: 14 additions & 14 deletions ports/litex/mpconfigport.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@ USB_SERIAL_NUMBER_LENGTH = 30
# Longints can be implemented as mpz, as longlong, or not
LONGINT_IMPL = MPZ

#Reduced feature set for early port
CIRCUITPY_MINIMAL_BUILD = 1
CIRCUITPY_ANALOGIO = 0
CIRCUITPY_AUDIOBUSIO = 0
CIRCUITPY_AUDIOIO = 0
CIRCUITPY_BITBANGIO = 0
CIRCUITPY_BOARD = 0
CIRCUITPY_BUSIO = 0
CIRCUITPY_DISPLAYIO = 0
CIRCUITPY_FREQUENCYIO = 0
CIRCUITPY_I2CSLAVE = 0
CIRCUITPY_NVM = 0
CIRCUITPY_PULSEIO = 0
CIRCUITPY_ROTARYIO = 0
CIRCUITPY_RTC = 0

# CIRCUITPY_BOARD = 1
# CIRCUITPY_DIGITALIO = 1
# CIRCUITPY_ANALOGIO = 1
# CIRCUITPY_MICROCONTROLLER = 1
# CIRCUITPY_BUSIO = 1
# CIRCUITPY_PULSEIO = 1
# CIRCUITPY_OS = 1
# CIRCUITPY_STORAGE = 1
# CIRCUITPY_RANDOM = 1
# Enable USB support
CIRCUITPY_USB_HID = 1
CIRCUITPY_USB_MIDI = 1

#ifeq ($(MCU_SUB_VARIANT), stm32f412zx)
#endif
4 changes: 4 additions & 0 deletions ports/litex/mphalport.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ void mp_hal_delay_ms(mp_uint_t delay) {
}
}

void mp_hal_delay_us(mp_uint_t delay) {
mp_hal_delay_ms(delay / 1000);
}

extern void SysTick_Handler(void);

__attribute__((section(".ramtext")))
Expand Down