8000 Pre Release Ameba MicroPython V1.1.0 - part2 (#4) · cwt/micropython@c566f5f · GitHub
[go: up one dir, main page]

Skip to content

Commit c566f5f

Browse files
xidamengambiot
andcommitted
Pre Release Ameba MicroPython V1.1.0 - part2 (micropython#4)
* [Add Ameba port] Add Ameba specific port src and dependency [Update linker] Update linker to resolve RAM shortage * [Add ignored files] add archive lib and pre-built binaries * [Multiple updates] Add ameba sdk as submodule, add postbild tool src, add amebad_tool, update makefile, relocate linker script * [Update Makefile] Update makefile to be compatible with all OS when extracting embedded toolchain * [Support and API] Add support for AMB23 RTL8722DM and update peripheral APIs - Add hardware support for AMB23 RTL8722DM (Previously known as RTL8722DM_MINI) - Update peripheral API for standardization - - timer - - ADC - - PWM(WIP) - Add Flash module to the port * [Pin/GPIO] Standardize Pin module API - Add new API and constants - Fix a bug found with REPL under readline.c * [PWM] Standardize PWM module API - Add machine_pwm.c from extmod as the micropython pwm binding - Add and update API to work like RP2 port * [UART] Standardize UART module API - Add new API and removing some existing ones - Update API to comply with RP2 style * [I2C] Standardize I2C module API - Re-structure the I2C module to make use of the generic I2C MicroPython binding - Add, remove and update API with be like RP2 style * [SPI] Standardize SPI module API - Re-structure the SPI module to make use of the MicroPython generic bindings - Add, remove and update API to be like RP2 style * [Readme] Update Readme to include more details - Update README.md to include more details - minor updates to i2c and timer module API * [README] Update README.md to provide more info about AMB23 * Pre Release Ameba MicroPython V1.1.0 - v2 - Update SDK and libs - Optimize memory usage and eliminate dependency on PSRAM Co-authored-by: ambiot <ambiot123@gmail.com>
1 parent 0246de4 commit c566f5f

File tree

5 files changed

+25
-28
lines changed

5 files changed

+25
-28
lines changed

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -204,10 +204,10 @@ PWM(pin_name[required], unit_id[optional])
204204
```
205205
Use help(PWM) to view more information about this class
206206

207-
Note: For RTL8722DM, PWM is only supported on the following pins,
207+
Note: For AMB21(RTL8722DM), PWM is only supported on the following pins,
208208
PA_23, PA_24, PA_25, PA_26
209209

210-
For MINI board,
210+
For AMB23(MINI) board,
211211
PB_4, PB_5, PB_7, PA_12, PA_13, PA_23, PA_24, PA_28, PA_30
212212

213213

@@ -324,13 +324,13 @@ PS: Leaving all parameters except tx and rx blank will set the uart to default v
324324
| timeout | 10 ms
325325
| flowCtrl | -1
326326

327-
Note: There are 2 sets of uart, they are
327+
For AMB21(RTL8722DM), there are 2 sets of uart, they are
328328
| unit | TX | RX
329329
|:-----|:------:|:-------:
330330
| 0 | PA_21 | PA_22
331331
| 3 | PA_26 | PA_25
332332

333-
For MINI board, they are
333+
For AMB23(MINI) board,
334334
| unit | TX | RX
335335
|:-----|:------:|:-------:
336336
| 0 | PA_21 | PA_22
@@ -348,7 +348,8 @@ Note: I2C only works in ```master``` mode.
348348

349349
```Python
350350
from machine import Pin, I2C
351-
i2c = I2C(scl = "PA_25", sda = "PA_26", freq=100000) # configure I2C with pins and freq. of 100KHz
351+
i2c = I2C(scl = "PA_25", sda = "PA_26", freq=100000) # configure I2C with pins and freq of 100KHz for AMB21
352+
# i2c = I2C(scl = "PA_31", sda = "PB_0", freq=100000) # configuration for AMB23(MINI)
352353
i2c.scan()
353354
i2c.writeto(8,bytes([123])) # send 1 byte to slave with address 8 with integer '123'
354355
i2c.writeto(8,str("asf")) # send a 3 bytes string to slave
@@ -395,12 +396,12 @@ PS: Leaving optional parameters blank will will assume taking default values whi
395396
| unit_id | 0
396397
| frequency | 100000 Hz
397398

398-
There is currently 1 set of I2C, it is
399+
For AMB21(RTL8722DM), there is currently 1 set of I2C, it is
399400
| unit | sda | scl
400401
|:-----|:------:|:------:
401402
| 0 | PA_26 | PA_25
402403

403-
For MINI board,
404+
For AMB23(MINI) board,
404405
| unit | sda | scl
405406
|:-----|:------:|:------:
406407
| 0 | PB_0 | PA_31
@@ -414,8 +415,7 @@ Use the ```SPI``` (Serial Peripheral Interface) module through ```machine``` mod
414415

415416
```Python
416417
from machine import SPI
417-
spi = SPI(1) # Only support 2 sets of SPI -- 0 and 1
418-
spi # type instance name to check for details of the SPI set
418+
spi = SPI(1) # Only support 2 sets of SPI -- 0 and 1, for connection please refer to the table below
419419
spi.write(bytes([123])) # Write number 123
420420
spi.read()
421421
```
@@ -462,13 +462,13 @@ PS: Leaving optional parameters blank will assume taking default values which ar
462462
| sck | N.A.
463463
| mode | Master
464464

465-
There is currently 2 set of SPI, they are,
465+
For AMB21(RTL8722DM), there is currently 2 set of SPI, they are,
466466
| unit | mosi | miso | SCK | CS
467467
|:-----|:------:|:-------:|:-----:|:-----:
468468
| 0 | PB_18 | PB_19 | PB_20 | PB_21
469469
| 1 | PB_4 | PB_5 | PB_6 | PB_7
470470

471-
For MINI board,
471+
For AMB23(MINI) board,
472472
| unit | mosi | miso | SCK | CS
473473
|:-----|:------:|:-------:|:-----:|:-----:
474474
| 1 | PA_12 | PA_13 | PA_14 | PA_15

main.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,11 @@ int main (void) {
139139
app_mbedtls_rom_init();
140140
#endif
141141

142+
//For all amebad boards, Analog pin needs to pull none. GPIO_PuPd_NOPULL/GPIO_PuPd_DOWN/GPIO_PuPd_UP
143+
PAD_PullCtrl(_PB_1, GPIO_PuPd_NOPULL);
144+
PAD_PullCtrl(_PB_2, GPIO_PuPd_NOPULL);
145+
PAD_PullCtrl(_PB_3, GPIO_PuPd_NOPULL);
146+
142147
/*
143148
struct task_struct stUpyTask;
144149
BaseType_t xReturn = rtw_create_task(&stUpyTask, MICROPY_TASK_NAME,

mp_helper/mods/modsocket.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,9 @@ int getHostByName(const char* aHostname)
270270
{
271271
ip_addr_t ip_addr;
272272
err_t err;
273-
err = netconn_gethostbyname(aHostname, &ip_addr);
273+
274+
//err = netconn_gethostbyname_addrtype(aHostname, &ip_addr, NETCONN_DNS_IPV4); // ipv6 xxm
275+
err = netconn_gethostbyname(aHostname, &ip_addr); // ipv4
274276

275277
if (err != ERR_OK) {
276278
return WL_FAILURE;

mpconfigport.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,9 @@ extern const struct _mp_obj_module_t mp_network_module;
197197
#define MICROPY_WLAN_AP_DEFAULT_SSID "YourSSID"
198198
#define MICROPY_WLAN_AP_DEFAULT_PASS "YourPSWD"
199199

200-
#define MP_HEAP_SIZE (180 * 1024)
200+
// Heap size for Garbage Collector
201+
#define MP_HEAP_SIZE (16 * 1024)
202+
//#define MP_HEAP_SIZE (180 * 1024) // xxm
201203
//#define MP_HEAP_SIZE (1124 * 1024)
202204

203205
#define MICROPY_TASK_NAME "MicroPython"

rlx8721d_img2_is_micropython.ld

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ SECTIONS
7575
{
7676
__bss_start__ = .;
7777
*(.bss*)
78-
/* *(COMMON) */
78+
*(COMMON)
7979
__bss_end__ = .;
8080
} > BD_RAM_NS
8181

@@ -96,7 +96,7 @@ SECTIONS
9696
*(.heap.stdlib*)
9797
. = . + 4096;
9898
__bfsram_end__ = .;
99-
} > PSRAM_NS
99+
} > BD_RAM_NS
100100

101101
.xip_image2.text :
102102
{
@@ -128,35 +128,23 @@ SECTIONS
128128
{
129129
__psram_image2_text_start__ = .;
130130
*(.psram.text*)
131-
*/py/*.o(.text*)
132-
*/lib/*.o(.text*)
133-
*/extmod/*.o(.text*)
134131
__psram_image2_text_end__ = .;
135132
} > PSRAM_NS
136133

137134
.psram_image2.data :
138135
{
139136
. = ALIGN (32);
140137
*(.psram.data*)
141-
*/py/*.o(.data*)
142-
*/lib/*.o(.data*)
143-
*/extmod/*.o(.data*)
144138
. = ALIGN (32);
145139
*(.psram.rodata*)
146-
*/py/*.o(.rodata*)
147-
*/lib/*.o(.rodata*)
148-
*/extmod/*.o(.rodata*)
149140
} > PSRAM_NS
150141

151142
.psram_image2.bss :
152143
{
153144
. = ALIGN (32);
154145
__psram_bss_start__ = .;
155146
*(.psram.bss*)
156-
*/py/*.o(.bss*)
157-
*/lib/*.o(.bss*)
158-
*/extmod/*.o(.bss*)
159-
*(COMMON)
147+
/* *(COMMON) */
160148
__psram_bss_end__ = .;
161149
} > PSRAM_NS
162150

0 commit comments

Comments
 (0)
0