Skip to content

Commit 6de625b

Browse files
committed
[finsh] Add finsh config (enabled by default)
- Modify code to adapt Arduino build process (e.g. `#include` directive) - Map Arduino "Serial" to RT-Thread device - Add "list_mem" to shell command - Modify example "Blink" accordingly - Update metadata files - Change version to (v0.2.0)
1 parent 7f2a24d commit 6de625b

37 files changed

+197
-65
lines changed

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@
22

33
This is a fork of [RT-Thread](https://github.com/RT-Thread/rt-thread) project and modified for Arduino.
44

5-
Currently only the kernel APIs are avaiable and most of the optional components are removed for the sake of simplicity. Some of the optional components may be added back later.
5+
Currently most of the optional components are removed for the sake of simplicity. Later, some of the those will be brought back.
66

77

8+
## Available Components ##
9+
* FinSH
10+
811
## Supported Architectures ##
912
* SAM (ARM Cortex-M3, Tested with Arduino Due)
1013
* SAMD (ARM Cortex-M0+, Tested with Arduino MKRZero)
1114

1215

1316
## Known Issues ##
14-
* Native USB port is not working currently.
15-
16-
So for Arduino Due, please connect to host with the "Programming Port"; and for "Arduino MKRZero", please avoid using "Serial" and "rt_kprintf" (by insert `#define CONFIG_NO_CONSOLE` before `#include <rtt.h>`).
17+
None

examples/Blink/Blink.ino

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,18 @@ bool led_state = false;
66

77
// user thread entry function
88
void blink_thread_entry(void* parameter) {
9-
rt_kprintf("Start blink_thread\n");
9+
rt_kprintf("Start Blink\n");
1010

1111
// the loop is here
1212
while (true) {
1313
led_state = !led_state;
1414
digitalWrite(LED_BUILTIN, led_state ? HIGH : LOW);
15-
rt_kprintf("Sleep for 1 second\n");
1615
rt_thread_sleep(RT_TICK_PER_SECOND);
1716
}
1817
}
1918

2019
// RT-Thread function called by "RT_T.begin()"
2120
void rt_application_init(void) {
22-
rt_kprintf("Call rt_application_init");
23-
2421
// statically initialize user thread
2522
if (RT_EOK != rt_thread_init(
2623
&blink_thread, // [in/out] thread descriptor
@@ -40,9 +37,6 @@ void rt_application_init(void) {
4037

4138
void setup() {
4239
pinMode(LED_BUILTIN, OUTPUT);
43-
Serial.begin(9600);
44-
while (!Serial);
45-
Serial.println("Start RT-Thread");
4640
RT_T.begin();
4741
}
4842

keywords.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ RT_T KEYWORD2
7070
CONFIG_HEAP_SIZE LITERAL1
7171
CONFIG_PRIORITY_MAX LITERAL1
7272
CONFIG_KERNEL_PRIORITY LITERAL1
73-
CONFIG_NO_CONSOLE LITERAL1
73+
CONFIG_USING_CONSOLE LITERAL1
74+
CONFIG_USING_FINSH LITERAL1
75+
CONFIG_SERIAL_DEVICE LITERAL1
7476
RT_EOK LITERAL1
7577
RT_ERROR LITERAL1
7678
RT_ETIMEOUT LITERAL1

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=RT-Thread
2-
version=0.1.0
2+
version=0.2.0
33
author=Bernard Xiong <[email protected]>
44
maintainer=onelife <[email protected]>
55
sentence=Real Time Operating System porting for Arduino SAM and SAMD boards

src/components/finsh/cmd.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
* Provide protection for the "first layer of objects" when list_*
3232
*/
3333

34-
#include <rthw.h>
35-
#include <rtthread.h>
34+
#include "include\rthw.h"
35+
#include "include\rtthread.h"
3636

3737
#ifdef RT_USING_FINSH
3838

src/components/finsh/finsh.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#ifndef __FINSH_H__
1111
#define __FINSH_H__
1212

13-
#include <rtthread.h>
13+
#include "include\rtthread.h"
1414
#include "finsh_api.h"
1515

1616
/* -- the beginning of option -- */

src/components/finsh/finsh_compiler.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Date Author Notes
88
* 2010-03-22 Bernard first version
99
*/
10-
#include <finsh.h>
10+
#include "finsh.h"
1111

1212
#include "finsh_node.h"
1313
#include "finsh_error.h"

src/components/finsh/finsh_error.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#ifndef __FINSH_ERROR_H__
1111
#define __FINSH_ERROR_H__
1212

13-
#include <finsh.h>
13+
#include "finsh.h"
1414

1515
int finsh_error_init(void);
1616

src/components/finsh/finsh_heap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Date Author Notes
88
* 2010-03-22 Bernard first version
99
*/
10-
#include <finsh.h>
10+
#include "finsh.h"
1111

1212
#include "finsh_var.h"
1313

src/components/finsh/finsh_heap.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Date Author Notes
88
* 2010-03-22 Bernard first version
99
*/
10-
#include <finsh.h>
10+
#include "finsh.h"
1111

1212
#ifndef __FINSH_HEAP_H__
1313
#define __FINSH_HEAP_H__

0 commit comments

Comments
 (0)