Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 958a5a2

Browse files
committed
[elf] Move config to "rtconfig.h"
[drv] Change SPI variable name to avoid conflict
1 parent e672334 commit 958a5a2

File tree

6 files changed

+41
-20
lines changed

6 files changed

+41
-20
lines changed

‎examples/FinSH/FinSH.ino‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
When using FinSH with MSH (default, CONFIG_USING_FINSH == 1 &&
3434
CONFIG_USING_MSH == 1):
3535
- please append the following line to "shell_cmd.h":
36-
ADD_MSH_CMD(led, Turn on/off builtin LED, led, rt_uint32_t, rt_uint32_t id, rt_uint8_t state)
36+
ADD_MSH_CMD(led, Turn on/off builtin LED, led, int, int argc, char **argv)
3737
- due to MSH doesn't support shell variables, "ADD_SHELL_VAR" has no effect
3838
3939
After uploaded, please send the following command through "Serial Monitor"
@@ -65,7 +65,7 @@ extern "C" {
6565

6666
#else /* !CONFIG_USING_MSH */
6767

68-
rt_uint32_t led(int argc, char **argv) {
68+
int led(int argc, char **argv) {
6969
// argc - the number of arguments
7070
// argv[0] - command name, e.g. "led"
7171
// argv[n] - nth argument in the type of char array

‎examples/HelloMo/HelloMo.ino‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
- add options "-mlong-calls -fPIC"
2020
2121
2. Link
22-
- you may copy the compiling command from Arduino's output window
22+
- you may copy the link command from Arduino's output window
2323
- keep only "hello_mo.c.o"
2424
- remove option "-Wl,--unresolved-symbols=report-all"
2525
- remove option "-LC:\\Users\\onelife\\AppData\\Local\\Temp\\arduino_build_362673"

‎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.6.0
2+
version=0.6.1
33
author=Bernard Xiong <bernard.xiong@gmail.com>, onelife <onelife.real@gmail.com>
44
maintainer=onelife <onelife.real@gmail.com>
55
sentence=Real Time Operating System porting for Arduino SAM and SAMD boards

‎src/components/arduino/drv_spi.cpp‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@ extern "C" {
4343
#endif /* RT_USING_ULOG */
4444

4545
#if CONFIG_USING_SPI0
46-
# define SPI0 SPI
46+
# define _SPI0 SPI
47+
#endif
48+
#if CONFIG_USING_SPI1
49+
# define _SPI1 SPI1
4750
#endif
4851
#define SPI_NAME(ch) "SPI"#ch
4952
#define SPI_CTX(idx) spi_ctx[idx]
@@ -374,13 +377,13 @@ rt_err_t bsp_hw_spi_init(void) {
374377
switch (chn) {
375378
#if CONFIG_USING_SPI0
376379
case 0:
377-
ldev = (void *)&SPI0;
380+
ldev = (void *)&_SPI0;
378381
name = SPI_NAME(0);
379382
break;
380383
#endif
381384
#if CONFIG_USING_SPI1
382385
case 1:
383-
ldev = (void *)&SPI1;
386+
ldev = (void *)&_SPI1;
384387
name = SPI_NAME(1);
385388
break;
386389
#endif

‎src/components/libc/libdl/dlmodule.c‎

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,17 @@
3030
# define LOG_D LOG_E
3131
#endif /* RT_USING_ULOG */
3232

33-
#define MODULE_MIN_STACK_SIZE (1024 * 2)
34-
#define MODULE_MAX_STACK_SIZE (1024 * 32)
35-
#define MODULE_DEFAULT_STACK_SIZE MODULE_MIN_STACK_SIZE
36-
#define MODULE_DEFAULT_TICK (10)
33+
#ifndef MODULE_THREAD_PRIORITY
34+
# define MODULE_THREAD_PRIORITY (RT_THREAD_PRIORITY_MAX - 1)
35+
#endif
36+
#ifndef MODULE_THREAD_STACK_SIZE
37+
# define MODULE_THREAD_STACK_SIZE (2 * 1024)
38+
#endif
39+
#ifndef MODULE_THREAD_TICK
40+
# define MODULE_THREAD_TICK (10)
41+
#endif
42+
#define MODULE_MIN_STACK_SIZE (1 * 1024)
43+
#define MODULE_MAX_STACK_SIZE (10 * 1024)
3744

3845
#define BREAK_WITH_WARN(err, msg, args...) {\
3946
LOG_W(msg, ##args); \
@@ -210,8 +217,8 @@ rt_dlmodule_t *dlmodule_create(void) {
210217
if (!module) return RT_NULL;
211218

212219
module->stat = RT_DLMODULE_STAT_INIT;
213-
module->priority = RT_THREAD_PRIORITY_MAX-1;
214-
module->stack_size = MODULE_DEFAULT_STACK_SIZE;
220+
module->priority = MODULE_THREAD_PRIORITY;
221+
module->stack_size = MODULE_THREAD_STACK_SIZE;
215222
rt_list_init(&(module->object_list));
216223
LOG_D("mo %s create", module->parent.name);
217224

@@ -553,9 +560,10 @@ rt_dlmodule_t *dlmodule_exec(const char* pgname, const char* cmd,
553560
if (module->priority > RT_THREAD_PRIORITY_MAX) {
554561
module->priority = RT_THREAD_PRIORITY_MAX - 1;
555562
}
556-
if ((module->stack_size < MODULE_MIN_STACK_SIZE) || \
557-
(module->stack_size > MODULE_MAX_STACK_SIZE)) {
558-
module->stack_size = MODULE_DEFAULT_STACK_SIZE;
563+
if (module->stack_size < MODULE_MIN_STACK_SIZE) {
564+
module->stack_size = MODULE_MIN_STACK_SIZE;
565+
} else if (module->stack_size > MODULE_MAX_STACK_SIZE) {
566+
module->stack_size = MODULE_MAX_STACK_SIZE;
559567
}
560568
LOG_D("priority: %d", module->priority);
561569
LOG_D("stack_size: %d", module->stack_size);
@@ -564,7 +572,7 @@ rt_dlmodule_t *dlmodule_exec(const char* pgname, const char* cmd,
564572
module->parent.name,
565573
_dlmodule_thread_entry, (void*)module,
566574
module->stack_size, module->priority,
567-
MODULE_DEFAULT_TICK);
575+
MODULE_THREAD_TICK);
568576
LOG_D("mo tid %x", tid);
569577
LOG_D("stack_addr: %p", tid->stack_addr);
570578

‎src/rtconfig.h‎

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,16 @@
7373

7474
#if (CONFIG_USING_MODULE)
7575
# define RT_USING_MODULE
76+
# define MODULE_THREAD_PRIORITY (RT_THREAD_PRIORITY_MAX - 1)
77+
# define MODULE_THREAD_STACK_SIZE (2 * 1024)
7678
# define IDLE_THREAD_STACK_SIZE (512)
7779
#endif /* CONFIG_USING_MODULE */
7880

7981
#if (CONFIG_USING_SPISD)
80-
# define CONFIG_USING_SPI1 (1)
82+
# ifdef ARDUINO_SAMD_MKRZERO
83+
# define CONFIG_USING_SPI1 (1)
84+
# endif /* ARDUINO_SAMD_MKRZERO */
85+
8186
# ifndef CONFIG_SD_CS_PIN
8287
# ifdef ARDUINO_SAMD_MKRZERO
8388
# define CONFIG_SD_CS_PIN (SDCARD_SS_PIN)
@@ -89,10 +94,15 @@
8994
# ifndef CONFIG_SD_SPI_CHANNEL
9095
# ifdef ARDUINO_SAMD_MKRZERO
9196
# define CONFIG_SD_SPI_CHANNEL 1 /* (1) is wrong -_-! */
92-
# else
93-
# error "Please define CONFIG_SD_SPI_CHANNEL!"
9497
# endif /* ARDUINO_SAMD_MKRZERO */
9598
# endif /* CONFIG_SD_SPI_CHANNEL */
99+
100+
# if (!defined(CONFIG_USING_SPI0) && !defined(CONFIG_USING_SPI1))
101+
# error "Please define CONFIG_USING_SPIx!"
102+
# endif /* (!defined(CONFIG_USING_SPI0) && !defined(CONFIG_USING_SPI1)) */
103+
# ifndef CONFIG_SD_SPI_CHANNEL
104+
# error "Please define CONFIG_SD_SPI_CHANNEL!"
105+
# endif /* CONFIG_SD_SPI_CHANNEL */
96106
#endif /* CONFIG_USING_SPISD */
97107

98108
#ifndef CONFIG_USING_SPI0

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /