Skip to content

Commit 8487eb8

Browse files
committed
Fix bug in 'machine.SPI' when building without 'Display' module included
Improved detection of ARM platform in 'BUILD.sh'
1 parent 05ca947 commit 8487eb8

File tree

14 files changed

+11
-1
lines changed

14 files changed

+11
-1
lines changed

MicroPython_BUILD/build_func.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
fs_type_fat="no"
33
fs_fat_sect=4096
44
linplatform=""
5+
linprocessor=""
6+
linmachine=""
57

68
#----------------
79
get_arguments() {
@@ -260,6 +262,8 @@ check_OS() {
260262
else
261263
if [ "${machine}" == "Linux" ]; then
262264
linplatform="$(uname -i)"
265+
linprocessor="$(uname -p)"
266+
linmachine="$(uname -m)"
263267
fi
264268
MK_SPIFFS_BIN="mkspiffs"
265269
MK_FATFS_BIN="mkfatfs"
@@ -356,7 +360,7 @@ check_Environment() {
356360
if [ "${linplatform}" == "i686" ]; then
357361
echo "unpacking ${machine}/xtensa-esp32-elf (32bit)"
358362
tar -xf ${machine}/xtensa-esp32-elf_32bit.tar.xz > /dev/null 2>&1
359-
elif [ "${linplatform}" == "armv7l" ]; then
363+
elif [ "${linplatform}" == "armv7l" ] || [ "${linprocessor}" == "armv7l" ] || [ "${linmachine}" == "armv7l" ]; then
360364
echo "unpacking ${machine}/xtensa-esp32-elf (arm)"
361365
tar -xf ${machine}/xtensa-esp32-elf_arm.tar.xz > /dev/null 2>&1
362366
else

MicroPython_BUILD/components/micropython/esp32/machine_hw_spi.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
* THE SOFTWARE.
2525
*/
2626

27+
#include "sdkconfig.h"
28+
2729
#include <stdio.h>
2830
#include <stdint.h>
2931
#include <string.h>
@@ -74,12 +76,16 @@ typedef struct _machine_hw_spi_obj_t {
7476
} state;
7577
} machine_hw_spi_obj_t;
7678

79+
#ifdef CONFIG_MICROPY_USE_DISPLAY
7780
extern uint8_t disp_used_spi_host;
81+
#endif
7882

7983
//-----------------------------------------------------------------
8084
int checkSPIBUS(int8_t bus, int8_t mosi, uint8_t miso, uint8_t sck)
8185
{
86+
#ifdef CONFIG_MICROPY_USE_DISPLAY
8287
if ((disp_used_spi_host > 0) && (MPy_SPIbus[disp_used_spi_host]->mosi_io_num >= 0)) return -3; // bus used by display driver
88+
#endif
8389

8490
if (MPy_SPIbus[bus] == NULL) return -2; // bus not available
8591
if (MPy_SPIbus[bus]->mosi_io_num < 0) return 1; // bus not configured, free to use
1 Byte
Binary file not shown.
2 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
-2 Bytes
Binary file not shown.
1 Byte
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)