Skip to content

Commit

Permalink
code synchronization at 2018-04-30@13:00
Browse files Browse the repository at this point in the history
  • Loading branch information
Cheng-SG committed Apr 30, 2018
1 parent b3200a9 commit cab5a98
Show file tree
Hide file tree
Showing 33 changed files with 1,464 additions and 39 deletions.
1 change: 1 addition & 0 deletions board/stm32l432kc-nucleo/stm32l432kc-nucleo.mk
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ HOST_ARCH := Cortex-M4
HOST_MCU_FAMILY := stm32l4xx_cube
SUPPORT_BINS := no
HOST_MCU_NAME := STM32L433RC-Nucleo
ENABLE_VFP := 1

$(NAME)_SOURCES += aos/board_partition.c \
aos/soc_init.c
Expand Down
4 changes: 3 additions & 1 deletion board/stm32l432kc-nucleo/ucube.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@
component.add_comp_deps('device/sal')
module = aos_global_config.get('module', 'wifi.mk3060')
if module == 'wifi.mk3060':
aos_global_config.set('module', 'wifi.mk3060')
aos_global_config.set('module', 'wifi.mk3060')

component.set_enable_vfp()
1 change: 1 addition & 0 deletions board/stm32l433rc-nucleo/stm32l433rc-nucleo.mk
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ HOST_ARCH := Cortex-M4
HOST_MCU_FAMILY := stm32l4xx_cube
SUPPORT_BINS := no
HOST_MCU_NAME := STM32L433RC-Nucleo
ENABLE_VFP := 1

$(NAME)_SOURCES += aos/board_partition.c \
aos/soc_init.c
Expand Down
4 changes: 3 additions & 1 deletion board/stm32l433rc-nucleo/ucube.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,6 @@
component.add_comp_deps('device/sal')
module = aos_global_config.get('module', 'wifi.mk3060')
if module == 'wifi.mk3060':
aos_global_config.set('module', 'wifi.mk3060')
aos_global_config.set('module', 'wifi.mk3060')

component.set_enable_vfp()
33 changes: 28 additions & 5 deletions build/aos_firmware_update.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
#!/usr/bin/env python

import sys, os, serial, time, platform, logging
from __future__ import division
from functools import partial
import sys
import os
import serial
import time
import platform
import logging

# MODEM Protocol bytes
NUL = b'\x00'
Expand Down Expand Up @@ -99,6 +105,8 @@ def abort(self, count=2, timeout=60):
for _ in range(count):
self.putc(CAN, timeout)



def send(self, stream, retry=16, timeout=60, quiet=False, callback=None):
'''
Send a stream via the XMODEM protocol.
Expand Down Expand Up @@ -177,6 +185,8 @@ def callback(total_packets, success_count, error_count)
error_count = 0
success_count = 0
total_packets = 0
image_size = 0 # the size of binary
max_cnt = 0 # the count is to be added when the frame(sequence) over 255(max block: 255k bytes)
if self.mode == 'ymodem':
sequence = 0
filenames = stream
Expand All @@ -194,6 +204,7 @@ def callback(total_packets, success_count, error_count)
stream = open(filename, 'rb')
stat = os.stat(filename)
data = os.path.basename(filename) + NUL + str(stat.st_size)
image_size = stat.st_size
self.log(LOG_LEVEL_DEBUG, 'ymodem sending : {0} len:{1}'.format(filename, stat.st_size))
else:
# empty file name packet terminates transmission
Expand Down Expand Up @@ -227,8 +238,13 @@ def callback(total_packets, success_count, error_count)

# emit packet & get ACK
while True:
self.log(LOG_LEVEL_DEBUG, 'send: block {0}'.format(sequence))
if (sequence == 255): max_cnt += 1
if (image_size != 0):
send_percent = (sequence + max_cnt*255)*100.0/(image_size/1000.0)
if (round(send_percent)%5 == 0):
print('[INFO]:send image process:%d%%\n' % send_percent)
self.putc(header + data + checksum)
time.sleep(0.1) # 100ms is needed to make more robust for differnt platform
char = self.getc(1, timeout)
if char == ACK:
success_count += 1
Expand All @@ -244,8 +260,11 @@ def callback(total_packets, success_count, error_count)
self.log(LOG_LEVEL_ERROR, 'send error: ymodem expected CRC; got {0} for block {1}'.format(char, sequence))
else:
break
if char == CRC:
curtime = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
self.log(LOG_LEVEL_ERROR, 'Got {0} for block {1} ts:{2}'.format(char, sequence, curtime))
continue

self.log(LOG_LEVEL_ERROR, 'send error: expected ACK; got {0} for block {1}'.format(char, sequence))
error_count += 1
if callable(callback):
callback(total_packets, success_count, error_count)
Expand All @@ -261,6 +280,7 @@ def callback(total_packets, success_count, error_count)

# emit EOT and get corresponding ACK
while True:
print('[INFO]:send image process:100%\n')
self.log(LOG_LEVEL_DEBUG, 'sending EOT, awaiting ACK')
# end of transmission
self.putc(EOT)
Expand Down Expand Up @@ -440,6 +460,7 @@ def recv(self, stream, crc_mode=1, retry=16, timeout=60, delay=1, quiet=0):
stream.write(data)
self.putc(ACK)
sequence = (sequence + 1) % 0x100
time.sleep(0.1) #100ms is needed to be robust for differnt platform
# get next start-of-header byte
char = self.getc(1, timeout)
continue
Expand All @@ -461,6 +482,7 @@ def recv(self, stream, crc_mode=1, retry=16, timeout=60, delay=1, quiet=0):
assert False, data
self.putc(NAK)
# get next start-of-header byte
time.sleep(0.1) #100ms is needed to be robust for differnt platform
char = self.getc(1, timeout)
continue

Expand Down Expand Up @@ -647,16 +669,17 @@ def print_usage():
time.sleep(0.03); port.write(" ") #0.20s
time.sleep(0.03); port.write(" ") #0.23s
time.sleep(0.03); port.write(" \r\n") #0.26s
if assert_response(["ootloader"], 1) == False:
if assert_response(["bootloader"], 1) == False:
sys.stderr.write("error: failed to enter bootloader\n")
sys.exit(1)
port.flushInput()

failed_num = 0
for [addr, image] in updates:
status_str = "updating {0} with {1} @ address {2} ...".format(device, image, addr)
status_str = "[INFO]: updating {0} with {1} @ address {2} ...".format(device, image, addr)
print status_str
port.write("write {0}\r\n".format(addr))
time.sleep(0.5) #500ms is needed to be robust for differnt platform
if assert_response(["Waiting for the file to be sent"], 1) == False:
sys.stderr.write("error: waiting for target to enter into YMODEM recived mode failed\n")
sys.exit(1)
Expand Down
Binary file modified framework/activation/ARM968E-S/activation.a
Binary file not shown.
Binary file modified framework/activation/Cortex-M4/IAR/activation.a
Binary file not shown.
Binary file modified framework/activation/Cortex-M4/KEIL/activation.a
Binary file not shown.
Binary file modified framework/activation/Cortex-M4/VFP/activation.a
Binary file not shown.
Binary file modified framework/activation/Cortex-M4/activation.a
Binary file not shown.
Binary file modified framework/activation/linux/activation.a
Binary file not shown.
Binary file modified framework/activation/xtensa/esp32/activation.a
Binary file not shown.
Binary file modified framework/activation/xtensa/esp8266/activation.a
Binary file not shown.
Binary file modified framework/bluetooth/ais_ilop/ali_lib/lib/cortex-m4/ali_lib.a
Binary file not shown.
Binary file not shown.
3 changes: 2 additions & 1 deletion framework/protocol/linkkit/alcs/src/alcs_adapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,8 @@ int iotx_alcs_adapter_init(iotx_alcs_adapter_t *adapter, iotx_alcs_param_t *para
return FAIL_RETURN;
}
if (alcs_mqtt_init(adapter->coap_ctx,product_key,device_name) != ALCS_MQTT_STATUS_SUCCESS) {
iotx_alcs_adapter_deinit();
/*solve the prpblem of hard fault when mqtt connection fails once*/
//iotx_alcs_adapter_deinit();
log_err("ALCS MQTT Init Failed");
return FAIL_RETURN;
}
Expand Down
Binary file modified framework/ywss/lib/arm968es/libywss.a
Binary file not shown.
Binary file modified framework/ywss/lib/cortex-m4/libywss.a
Binary file not shown.
Binary file modified framework/ywss/lib/xtensa/libywss.a
Binary file not shown.
Binary file modified framework/ywss4linkkit/lib/arm968es/libywss.a
100755 → 100644
Binary file not shown.
Binary file modified framework/ywss4linkkit/lib/cortex-m4/libywss.a
100755 → 100644
Binary file not shown.
Binary file modified framework/ywss4linkkit/lib/linux/libywss.a
100755 → 100644
Binary file not shown.
Binary file modified framework/ywss4linkkit/lib/xtensa/libywss.a
100755 → 100644
Binary file not shown.
Loading

0 comments on commit cab5a98

Please sign in to comment.