Skip to content

Commit 55eb173

Browse files
committed
Merge remote-tracking branch 'adafruit/master' into tweak_pixelbuf
2 parents 2cc20e8 + d22e95e commit 55eb173

File tree

62 files changed

+2598
-148
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+2598
-148
lines changed

.github/workflows/build.yml

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ jobs:
2222
python-version: 3.5
2323
- name: Install deps
2424
run: |
25-
sudo apt-get install -y gettext librsvg2-bin
25+
sudo apt-get install -y eatmydata
26+
sudo eatmydata apt-get install -y gettext librsvg2-bin mingw-w64
2627
pip install requests sh click setuptools cpp-coveralls Sphinx sphinx-rtd-theme recommonmark sphinxcontrib-svg2pdfconverter polib pyyaml
2728
- name: Versions
2829
run: |
@@ -66,6 +67,54 @@ jobs:
6667
run: python3 -u ci_new_boards_check.py
6768
working-directory: tools
6869

70+
- name: Build mpy-cross.static-raspbian
71+
run: make -C mpy-cross -j2 -f Makefile.static-raspbian
72+
- uses: actions/[email protected]
73+
with:
74+
name: mpy-cross.static-raspbian
75+
path: mpy-cross/mpy-cross.static-raspbian
76+
77+
- name: Build mpy-cross.static
78+
run: make -C mpy-cross -j2 -f Makefile.static
79+
- uses: actions/[email protected]
80+
with:
81+
name: mpy-cross.static-amd64-linux
82+
path: mpy-cross/mpy-cross.static
83+
84+
- name: Build mpy-cross.static-mingw
85+
run: make -C mpy-cross -j2 -f Makefile.static-mingw
86+
- uses: actions/[email protected]
87+
with:
88+
name: mpy-cross.static-x64-windows
89+
path: mpy-cross/mpy-cross.static.exe
90+
91+
mpy-cross-mac:
92+
runs-on: macos-latest
93+
steps:
94+
- name: Dump GitHub context
95+
env:
96+
GITHUB_CONTEXT: ${{ toJson(github) }}
97+
run: echo "$GITHUB_CONTEXT"
98+
- name: Install deps
99+
run: |
100+
brew link --force gettext
101+
- name: Versions
102+
run: |
103+
gcc --version
104+
python3 --version
105+
msgfmt --version
106+
- uses: actions/checkout@v1
107+
with:
108+
submodules: true
109+
- name: CircuitPython version
110+
run: git describe --dirty --always --tags
111+
- name: Build mpy-cross
112+
run: make -C mpy-cross -j2
113+
- uses: actions/[email protected]
114+
with:
115+
name: mpy-cross-macos-catalina
116+
path: mpy-cross/mpy-cross
117+
69118
build-arm:
70119
runs-on: ubuntu-16.04
71120
needs: test
@@ -121,6 +170,7 @@ jobs:
121170
- "kicksat-sprite"
122171
- "makerdiary_nrf52840_mdk"
123172
- "makerdiary_nrf52840_mdk_usb_dongle"
173+
- "meowbit_v121"
124174
- "meowmeow"
125175
- "metro_m0_express"
126176
- "metro_m4_airlift_lite"

main.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@
5757
#include "supervisor/shared/stack.h"
5858
#include "supervisor/serial.h"
5959

60+
#include "boards/board.h"
61+
6062
#if CIRCUITPY_DISPLAYIO
6163
#include "shared-module/displayio/__init__.h"
6264
#endif
@@ -425,6 +427,9 @@ int __attribute__((used)) main(void) {
425427
// no SPI flash filesystem, and we might erase the existing one.
426428
filesystem_init(safe_mode == NO_SAFE_MODE, false);
427429

430+
// displays init after filesystem, since they could share the flash SPI
431+
board_init();
432+
428433
// Reset everything and prep MicroPython to run boot.py.
429434
reset_port();
430435
reset_board();

mpy-cross/.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1-
mpy-cross
1+
/build-*
2+
/mpy-cross
3+
/mpy-cross.static
4+
/mpy-cross.static.exe
5+
/mpy-cross.static-raspbian
6+
/pitools

mpy-cross/Makefile

Lines changed: 1 addition & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -11,84 +11,4 @@ override undefine BUILD
1111
override undefine PROG
1212
endif
1313

14-
include ../py/mkenv.mk
15-
16-
# define main target
17-
18-
ifeq ($(OS),Windows_NT)
19-
# Detect a MINGW32 build, and change the name of the final executable.
20-
PROG = mpy-cross.exe
21-
else
22-
PROG = mpy-cross
23-
endif
24-
25-
# qstr definitions (must come before including py.mk)
26-
QSTR_DEFS = qstrdefsport.h
27-
28-
# OS name, for simple autoconfig
29-
UNAME_S := $(shell uname -s)
30-
31-
# include py core make definitions
32-
include $(TOP)/py/py.mk
33-
34-
INC += -I.
35-
INC += -I$(TOP)
36-
INC += -I$(BUILD)
37-
38-
# compiler settings
39-
CWARN = -Wall -Werror
40-
CWARN += -Wpointer-arith -Wuninitialized
41-
CFLAGS = $(INC) $(CWARN) -std=gnu99 $(CFLAGS_MOD) $(COPT) $(CFLAGS_EXTRA)
42-
CFLAGS += -fdata-sections -ffunction-sections -fno-asynchronous-unwind-tables
43-
44-
# Build a static executable.
45-
# Useful for Windows builds, etc., that must run on multiple operating system versions.
46-
ifdef STATIC_BUILD
47-
CFLAGS += -static -static-libgcc -static-libstdc++
48-
endif
49-
50-
51-
# Debugging/Optimization
52-
ifdef DEBUG
53-
CFLAGS += -g
54-
COPT = -O0
55-
else
56-
COPT = -Os #-DNDEBUG
57-
endif
58-
59-
# On OSX, 'gcc' is a symlink to clang unless a real gcc is installed.
60-
# The unix port of MicroPython on OSX must be compiled with clang,
61-
# while cross-compile ports require gcc, so we test here for OSX and
62-
# if necessary override the value of 'CC' set in py/mkenv.mk
63-
ifeq ($(UNAME_S),Darwin)
64-
CC = clang
65-
# Use clang syntax for map file
66-
LDFLAGS_ARCH = -Wl,-map,$@.map -Wl,-dead_strip
67-
else
68-
# Use gcc syntax for map file
69-
LDFLAGS_ARCH = -Wl,-Map=$@.map,--cref -Wl,--gc-sections
70-
endif
71-
LDFLAGS = $(LDFLAGS_MOD) $(LDFLAGS_ARCH) -lm $(LDFLAGS_EXTRA)
72-
73-
ifdef STATIC_BUILD
74-
LDFLAGS += -static -static-libgcc -static-libstdc++
75-
endif
76-
77-
# source files
78-
SRC_C = \
79-
main.c \
80-
gccollect.c \
81-
supervisor/stub/safe_mode.c \
82-
supervisor/stub/stack.c \
83-
supervisor/shared/translate.c
84-
85-
# Add fmode when compiling with mingw gcc
86-
COMPILER_TARGET := $(shell $(CC) -dumpmachine)
87-
ifneq (,$(findstring mingw,$(COMPILER_TARGET)))
88-
SRC_C += ports/windows/fmode.c
89-
endif
90-
91-
OBJ = $(PY_O)
92-
OBJ += $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
93-
94-
include $(TOP)/py/mkrules.mk
14+
include mpy-cross.mk

mpy-cross/Makefile.static

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
PROG=mpy-cross.static
2+
BUILD=build-static
3+
STATIC_BUILD=1
4+
5+
include mpy-cross.mk

mpy-cross/Makefile.static-mingw

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
PROG=mpy-cross.static.exe
2+
CROSS_COMPILE = x86_64-w64-mingw32-
3+
BUILD=build-static-mingw
4+
STATIC_BUILD=1
5+
6+
include mpy-cross.mk

mpy-cross/Makefile.static-raspbian

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
PROG=mpy-cross.static-raspbian
2+
BUILD=build-static-raspbian
3+
STATIC_BUILD=1
4+
5+
CROSS_COMPILE = pitools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-
6+
include mpy-cross.mk
7+
8+
$(shell [ -d pitools ] || git clone --progress --verbose https://github.com/raspberrypi/tools.git --depth=1 pitools)

mpy-cross/fmode.c

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
* This file is part of the MicroPython project, http://micropython.org/
3+
*
4+
* The MIT License (MIT)
5+
*
6+
* Copyright (c) 2013-2016 Damien P. George
7+
*
8+
* Permission is hereby granted, free of charge, to any person obtaining a copy
9+
* of this software and associated documentation files (the "Software"), to deal
10+
* in the Software without restriction, including without limitation the rights
11+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12+
* copies of the Software, and to permit persons to whom the Software is
13+
* furnished to do so, subject to the following conditions:
14+
*
15+
* The above copyright notice and this permission notice shall be included in
16+
* all copies or substantial portions of the Software.
17+
*
18+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24+
* THE SOFTWARE.
25+
*/
26+
27+
#include "fmode.h"
28+
#include "py/mpconfig.h"
29+
#include <fcntl.h>
30+
#include <stdlib.h>
31+
32+
// Workaround for setting file translation mode: we must distinguish toolsets
33+
// since mingw has no _set_fmode, and altering msvc's _fmode directly has no effect
34+
STATIC int set_fmode_impl(int mode) {
35+
#ifndef _MSC_VER
36+
_fmode = mode;
37+
return 0;
38+
#else
39+
return _set_fmode(mode);
40+
#endif
41+
}
42+
43+
void set_fmode_binary(void) {
44+
set_fmode_impl(O_BINARY);
45+
}
46+
47+
void set_fmode_text(void) {
48+
set_fmode_impl(O_TEXT);
49+
}

mpy-cross/fmode.h

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* This file is part of the MicroPython project, http://micropython.org/
3+
*
4+
* The MIT License (MIT)
5+
*
6+
* Copyright (c) 2013-2016 Damien P. George
7+
*
8+
* Permission is hereby granted, free of charge, to any person obtaining a copy
9+
* of this software and associated documentation files (the "Software"), to deal
10+
* in the Software without restriction, including without limitation the rights
11+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12+
* copies of the Software, and to permit persons to whom the Software is
13+
* furnished to do so, subject to the following conditions:
14+
*
15+
* The above copyright notice and this permission notice shall be included in
16+
* all copies or substantial portions of the Software.
17+
*
18+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24+
* THE SOFTWARE.
25+
*/
26+
#ifndef MICROPY_INCLUDED_WINDOWS_FMODE_H
27+
#define MICROPY_INCLUDED_WINDOWS_FMODE_H
28+
29+
// Treat files opened by open() as binary. No line ending translation is done.
30+
void set_fmode_binary(void);
31+
32+
// Treat files opened by open() as text.
33+
// When reading from the file \r\n will be converted to \n.
34+
// When writing to the file \n will be converted into \r\n.
35+
void set_fmode_text(void);
36+
37+
#endif // MICROPY_INCLUDED_WINDOWS_FMODE_H

0 commit comments

Comments
 (0)