Skip to content
This repository has been archived by the owner on Sep 16, 2024. It is now read-only.

Commit

Permalink
Merge pull request #456 from pycom/v1.20.2.rc9_Dev_againagain
Browse files Browse the repository at this point in the history
V1.20.2.rc9
  • Loading branch information
Xykon authored Jun 10, 2020
2 parents 6d01270 + 38d9cc7 commit 1a257d8
Show file tree
Hide file tree
Showing 32 changed files with 232 additions and 157 deletions.
2 changes: 1 addition & 1 deletion esp32/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ ifeq ($(wildcard boards/$(BOARD)/.),)
$(error Invalid BOARD specified)
endif

IDF_HASH=d072c55
IDF_HASH=6ec081c

TARGET ?= boot_app

Expand Down
11 changes: 11 additions & 0 deletions esp32/PyJTAG/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,17 @@ It can be advisable to use the `gdb` from the latest xtensa toolchain, even if a

If `gdb` does not reach the `Thread 1 hit Temporary breakpoint ...` line, close and reopen `gdb`.


## Versions
There are two generations of PyJTAG boards:

1) First generation with green PCB has three blocks of switches. (Make sure SAFE_BOOT_SW is off.)
2) Second generation with black PCB and two blocks of switches.

Both generation boards can be equipped with pogo pins that connect to the bottom of the development board and allow LTE debugging. There can either be pins that connect to a GPy or pins that conenct to a FiPy.

To reach the modem UART connect to `/dev/ttyUSB1`.

## Extra
A few more details are here: https://pycomiot.atlassian.net/wiki/spaces/FIR/pages/966295564/Usage+of+PyJTAG

2 changes: 1 addition & 1 deletion esp32/fatfs/src/drivers/sflash_diskio.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ DRESULT sflash_disk_init (void) {
sflash_start_address = SFLASH_START_ADDR_4MB;
sflash_fs_sector_count = SFLASH_FS_SECTOR_COUNT_4MB;
}
sflash_block_cache = (uint8_t *)heap_caps_malloc(SFLASH_BLOCK_SIZE, MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT);
sflash_block_cache = (uint8_t *)malloc(SFLASH_BLOCK_SIZE);
sflash_prev_block_addr = UINT32_MAX;
sflash_cache_is_dirty = false;
sflash_init_done = true;
Expand Down
17 changes: 7 additions & 10 deletions esp32/frozen/Pybytes/_pybytes.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,16 +273,13 @@ def connect(self):
self.enable_terminal()

# CHECK PYMESH FIRMWARE VERSION
try:
if hasattr(os.uname(),'pymesh'):
try:
from pybytes_pymesh_config import PybytesPymeshConfig
except:
from _pybytes_pymesh_config import PybytesPymeshConfig
self.__pymesh = PybytesPymeshConfig(self)
self.__pymesh.pymesh_init()
except Exception as e:
print("Exception: {}".format(e))
if hasattr(os.uname(), 'pymesh'):
try:
from pybytes_pymesh_config import PybytesPymeshConfig
except:
from _pybytes_pymesh_config import PybytesPymeshConfig
self.__pymesh = PybytesPymeshConfig(self)
self.__pymesh.pymesh_init()
else:
print('ERROR! Could not connect to Pybytes!')

Expand Down
1 change: 1 addition & 0 deletions esp32/frozen/Pybytes/_pybytes_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ class constants:
__FCOTA_COMMAND_FILE_UPDATE = 0x02
__FCOTA_PING = 0x03
__FCOTA_COMMAND_FILE_DELETE = 0x04
__FCOTA_COMMAND_FILE_UPDATE_NO_RESET = 0x05

__DEVICE_TYPE_WIPY = 0x00
__DEVICE_TYPE_LOPY = 0x01
Expand Down
17 changes: 17 additions & 0 deletions esp32/frozen/Pybytes/_pybytes_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,23 @@ def __process_recv_message(self, message):
else:
self.send_fcota_ping("file update failed!")

elif (command == constants.__FCOTA_COMMAND_FILE_UPDATE_NO_RESET):
bodyString = body[1:len(body)].decode()
splittedBody = bodyString.split(',')
if (len(splittedBody) >= 2):
path = splittedBody[0]
print_debug(2, path[len(path)-7:len(path)])
if (path[len(path)-7:len(path)] != '.pymakr'):
self.send_fcota_ping('updating file...')
newContent = bodyString[len(path)+1:len(body)]
if (self.__FCOTA.update_file_content(path, newContent) is True): # noqa
size = self.__FCOTA.get_file_size(path)
self.send_fcota_file(newContent, path, size)
else:
self.send_fcota_ping('file update failed!')
else:
self.send_fcota_ping("file update failed!")

elif (command == constants.__FCOTA_PING):
self.send_fcota_ping('')

Expand Down
2 changes: 1 addition & 1 deletion esp32/frozen/Pybytes/_pybytes_pymesh_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def write_config(self, wmac, file='/flash/pymesh_config.json', pymeshSettings={}
"ble_api": False,
"ble_name_prefix": "Device-{}".format(wmac),
"br_prio": 0,
"br_ena": False,
"br_ena": customSettings["br_ena"],
"autostart": True
}

Expand Down
20 changes: 10 additions & 10 deletions esp32/ftp/ftp.c
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ STATIC FRESULT f_readdir_helper(ftp_dir_t *dp, ftp_fileinfo_t *fno ) {
if(length_of_relative_path > 1) {
path_length++;
}
char* file_relative_path = m_malloc(path_length);
char* file_relative_path = malloc(path_length);

// Copy the current working directory (relative path)
memcpy(file_relative_path, path_relative, length_of_relative_path);
Expand All @@ -359,7 +359,7 @@ STATIC FRESULT f_readdir_helper(ftp_dir_t *dp, ftp_fileinfo_t *fno ) {
fno->u.fpinfo_lfs.timestamp.ftime = 0;
}

m_free(file_relative_path);
free(file_relative_path);
}

xSemaphoreGive(littlefs->mutex);
Expand Down Expand Up @@ -614,10 +614,10 @@ static void ftp_return_to_previous_path (char *pwd, char *dir);
******************************************************************************/
void ftp_init (void) {
// allocate memory for the data buffer, and the file system structs (from the RTOS heap)
ftp_data.dBuffer = heap_caps_malloc(FTP_BUFFER_SIZE, MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT);
ftp_path = heap_caps_malloc(FTP_MAX_PARAM_SIZE, MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT);
ftp_scratch_buffer = heap_caps_malloc(FTP_MAX_PARAM_SIZE, MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT);
ftp_cmd_buffer = heap_caps_malloc(FTP_MAX_PARAM_SIZE + FTP_CMD_SIZE_MAX, MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT);
ftp_data.dBuffer = malloc(FTP_BUFFER_SIZE);
ftp_path = malloc(FTP_MAX_PARAM_SIZE);
ftp_scratch_buffer = malloc(FTP_MAX_PARAM_SIZE);
ftp_cmd_buffer = malloc(FTP_MAX_PARAM_SIZE + FTP_CMD_SIZE_MAX);
SOCKETFIFO_Init (&ftp_socketfifo, (void *)ftp_fifoelements, FTP_SOCKETFIFO_ELEMENTS_MAX);
ftp_data.c_sd = -1;
ftp_data.d_sd = -1;
Expand Down Expand Up @@ -933,7 +933,7 @@ static void ftp_send_reply (uint32_t status, char *message) {
strcat ((char *)ftp_cmd_buffer, "\r\n");
fifoelement.sd = &ftp_data.c_sd;
fifoelement.datasize = strlen((char *)ftp_cmd_buffer);
fifoelement.data = pvPortMalloc(fifoelement.datasize);
fifoelement.data = malloc(fifoelement.datasize);
if (status == 221) {
fifoelement.closesockets = E_FTP_CLOSE_CMD_AND_DATA;
} else if (status == 426 || status == 451 || status == 550) {
Expand All @@ -945,7 +945,7 @@ static void ftp_send_reply (uint32_t status, char *message) {
if (fifoelement.data) {
memcpy (fifoelement.data, ftp_cmd_buffer, fifoelement.datasize);
if (!SOCKETFIFO_Push (&fifoelement)) {
vPortFree(fifoelement.data);
free(fifoelement.data);
}
}
}
Expand Down Expand Up @@ -979,13 +979,13 @@ static void ftp_send_from_fifo (void) {
ftp_close_filesystem_on_error();
}
if (fifoelement.freedata) {
vPortFree(fifoelement.data);
free(fifoelement.data);
}
}
} else { // socket closed, remove it from the queue
SOCKETFIFO_Pop (&fifoelement);
if (fifoelement.freedata) {
vPortFree(fifoelement.data);
free(fifoelement.data);
}
}
} else if (ftp_data.state == E_FTP_STE_END_TRANSFER && (ftp_data.d_sd > 0)) {
Expand Down
5 changes: 2 additions & 3 deletions esp32/littlefs/lfs_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

#include "py/mpconfig.h"
#include "py/misc.h"
#include "py/gc.h"

// System includes
#include <stdint.h>
Expand Down Expand Up @@ -204,7 +203,7 @@ uint32_t lfs_crc(uint32_t crc, const void *buffer, size_t size);
// Note, memory must be 64-bit aligned
static inline void *lfs_malloc(size_t size) {
#ifndef LFS_NO_MALLOC
return gc_alloc(size, false);
return malloc(size);
#else
return NULL;
#endif
Expand All @@ -213,7 +212,7 @@ static inline void *lfs_malloc(size_t size) {
// Deallocate memory, only used if buffers are not provided to littlefs
static inline void lfs_free(void *p) {
#ifndef LFS_NO_MALLOC
m_free(p);
free(p);
#endif
}

Expand Down
Loading

0 comments on commit 1a257d8

Please sign in to comment.