Skip to content

Commit 376e857

Browse files
committed
[cfg] Reduce memory usage
1 parent 9c5e4e4 commit 376e857

File tree

3 files changed

+86
-60
lines changed

3 files changed

+86
-60
lines changed

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.7.6
2+
version=0.7.7
33
author=onelife <[email protected]>, Bernard Xiong <[email protected]>
44
maintainer=onelife <[email protected]>
55
sentence=Real Time Operating System porting for Arduino SAM and SAMD boards

src/components/arduino/drv_spi_ssd1331.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -359,10 +359,9 @@ static rt_err_t bsp_ssd1331_init(rt_device_t dev) {
359359

360360
static rt_err_t bsp_ssd1331_control(rt_device_t dev, rt_int32_t cmd,
361361
void *args) {
362+
struct bsp_ssd_contex *ctx = SSD_CTX();
362363
rt_err_t ret = -RT_ERROR;
363-
#if CONFIG_USING_GUI
364-
struct bsp_ssd_contex *ctx = SSD_CTX();
365-
#else
364+
#if !CONFIG_USING_GUI
366365
(void)args;
367366
#endif
368367
(void)dev;

src/rtconfig.h

Lines changed: 83 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,14 @@
66
#ifndef __RTCONFIG_H__
77
#define __RTCONFIG_H__
88

9+
/* User Config */
10+
11+
// #define CONFIG_USING_ADAFRUIT_TFT_CAPACITIVE
12+
// #define CONFIG_USING_TINYSCREEN
13+
14+
15+
/* Hardware Config */
916

10-
/* Hardware Options */
1117
/* Adafruit 2.8" TFT Touch Shield v2 (Capacitive) */
1218
#ifdef CONFIG_USING_ADAFRUIT_TFT_CAPACITIVE
1319
# ifdef ARDUINO_SAM_DUE
@@ -32,7 +38,7 @@
3238
# define CONFIG_GUI_WIDTH (240)
3339
# define CONFIG_GUI_HIGH (320)
3440
# else
35-
# error "Not implement yet!"
41+
# error "Not supporting yet!"
3642
# endif /* ARDUINO_SAM_DUE */
3743
#endif /* CONFIG_USING_ADAFRUIT_TFT_CAPACITIVE */
3844

@@ -42,7 +48,7 @@
4248
# define CONFIG_USING_SPI0 (1)
4349
# define CONFIG_USING_SPI1 (1)
4450

45-
# define CONFIG_USING_MODULE (1)
51+
// # define CONFIG_USING_MODULE (1)
4652
# define CONFIG_USING_SPISD (1)
4753
# define CONFIG_SD_CS_PIN (SS)
4854
# define CONFIG_SD_SPI_CHANNEL 0
@@ -54,8 +60,7 @@
5460
# define CONFIG_SSD_PWR_PIN (27)
5561
# define CONFIG_SSD_SPI_CHANNEL 1
5662

57-
# define CONFIG_USING_BUTTON (6)
58-
/* UP, DOWN, LEFT, RIGHT, A, B */
63+
# define CONFIG_USING_BUTTON (6) /* UP, DOWN, LEFT, RIGHT, A, B */
5964
# define CONFIG_BUTTON_PIN { 42, 19, 25, 15, 45, 44 }
6065
# define CONFIG_BUTTON_CODE { 273, 274, 276, 275, 97, 98 }
6166

@@ -70,30 +75,33 @@
7075

7176
# define CONFIG_USING_SPISD (1)
7277
# define CONFIG_SD_CS_PIN (SDCARD_SS_PIN)
73-
# define CONFIG_SD_SPI_CHANNEL 1 /* (1) is wrong -_-! */
78+
# define CONFIG_SD_SPI_CHANNEL 1 /* (1) is wrong -_-! */
7479
#endif /* ARDUINO_SAMD_MKRZERO */
7580

7681

77-
/* Porting Options */
82+
/* Arduino Config */
83+
7884
#define CONFIG_ARDUINO
85+
#define CONFIG_TICK_PER_SECOND (1000) /* Platform */
7986

80-
#define CONFIG_TICK_PER_SECOND (1000) /* Arduino */
87+
#ifndef CONFIG_PRIORITY_MAX
88+
# define CONFIG_PRIORITY_MAX (3) /* NVIC */
89+
#endif
90+
91+
#ifndef CONFIG_KERNEL_PRIORITY
92+
# define CONFIG_KERNEL_PRIORITY (2) /* Platform */
93+
#endif
8194

8295
#ifndef CONFIG_HEAP_SIZE
8396
# ifdef ARDUINO_ARCH_SAM
8497
# define CONFIG_HEAP_SIZE (40 * 1024)
8598
# else
8699
# define CONFIG_HEAP_SIZE (20 * 1024)
87100
# endif
88-
#endif /* CONFIG_HEAP_SIZE */
89-
90-
#ifndef CONFIG_PRIORITY_MAX
91-
# define CONFIG_PRIORITY_MAX (3)
92101
#endif
93102

94-
#ifndef CONFIG_KERNEL_PRIORITY
95-
# define CONFIG_KERNEL_PRIORITY (2)
96-
#endif
103+
104+
/* Default User Config */
97105

98106
#ifndef CONFIG_USING_RTC
99107
# define CONFIG_USING_RTC (0)
@@ -135,6 +143,10 @@
135143
# define CONFIG_USING_SPISD (0)
136144
#endif
137145

146+
#ifndef CONFIG_USING_EXFAT
147+
# define CONFIG_USING_EXFAT (0)
148+
#endif
149+
138150
#ifndef CONFIG_USING_ILI
139151
# define CONFIG_USING_ILI (0)
140152
#endif
@@ -147,6 +159,25 @@
147159
# define CONFIG_USING_FT6206 (0)
148160
#endif
149161

162+
#ifndef CONFIG_USING_SPI0
163+
# define CONFIG_USING_SPI0 (0)
164+
#endif
165+
166+
#ifndef CONFIG_USING_SPI1
167+
# define CONFIG_USING_SPI1 (0)
168+
#endif
169+
170+
#ifndef CONFIG_USING_IIC0
171+
# define CONFIG_USING_IIC0 (0)
172+
#endif
173+
174+
#ifndef CONFIG_USING_IIC1
175+
# define CONFIG_USING_IIC1 (0)
176+
#endif
177+
178+
179+
/* Config Check */
180+
150181
#if (CONFIG_USING_CONSOLE)
151182
# ifndef CONFIG_SERIAL_DEVICE
152183
# define CONFIG_SERIAL_DEVICE (Serial)
@@ -155,7 +186,7 @@
155186

156187
#if (CONFIG_USING_LOG)
157188
# define RT_USING_ULOG
158-
# define ULOG_OUTPUT_LVL (LOG_LVL_DBG)
189+
# define ULOG_OUTPUT_LVL (LOG_LVL_DBG) // (LOG_LVL_INFO)
159190
# define ULOG_ASSERT_ENABLE
160191
# define ULOG_USING_COLOR
161192
// # define ULOG_USING_ISR_LOG
@@ -174,8 +205,8 @@
174205
#if (CONFIG_USING_MODULE)
175206
# define RT_USING_MODULE
176207
# define MODULE_THREAD_PRIORITY (RT_THREAD_PRIORITY_MAX - 1)
177-
# define MODULE_THREAD_STACK_SIZE (2 * 1024)
178-
# define IDLE_THREAD_STACK_SIZE (512)
208+
# define MODULE_THREAD_STACK_SIZE (4 * 512)
209+
# define IDLE_THREAD_STACK_SIZE (1 * 512)
179210
#endif /* CONFIG_USING_MODULE */
180211

181212
#if (CONFIG_USING_SPISD)
@@ -217,29 +248,14 @@
217248
# endif
218249
#endif /* CONFIG_USING_GUI */
219250

220-
#ifndef CONFIG_USING_SPI0
221-
# define CONFIG_USING_SPI0 (0)
222-
#endif
223-
224-
#ifndef CONFIG_USING_SPI1
225-
# define CONFIG_USING_SPI1 (0)
226-
#endif
227-
228-
#ifndef CONFIG_USING_IIC0
229-
# define CONFIG_USING_IIC0 (0)
230-
#endif
231-
232-
#ifndef CONFIG_USING_IIC1
233-
# define CONFIG_USING_IIC1 (0)
234-
#endif
235-
236251
#if CONFIG_USING_RTC
237252
# define RT_USING_RTC
238253
# define RT_USING_ALARM
239254
#endif
240255

241256

242-
/* Debug Options */
257+
/* Debug Config */
258+
243259
// #define RT_DEBUG
244260
// #define RT_USING_OVERFLOW_CHECK
245261
// #define RT_USING_MEMTRACE
@@ -251,58 +267,65 @@
251267
// #define RT_DEBUG_THREAD (1)
252268

253269

254-
/* System Options */
270+
/* System Config */
271+
255272
#define RT_NAME_MAX (16)
256273
#define RT_ALIGN_SIZE (4)
257274
#define RT_THREAD_PRIORITY_MAX (32)
258275
#define RT_TICK_PER_SECOND (100)
259276

260277

261-
/* Arduino Thread Options */
278+
/* Arduino Thread Config */
279+
262280
#ifndef CONFIG_ARDUINO_STACK_SIZE
263-
# define CONFIG_ARDUINO_STACK_SIZE (2 * 1024)
281+
# define CONFIG_ARDUINO_STACK_SIZE (3 * 512)
264282
#endif
265283
#ifndef CONFIG_ARDUINO_PRIORITY
266284
# define CONFIG_ARDUINO_PRIORITY (RT_THREAD_PRIORITY_MAX >> 1)
267285
#endif
268286
#ifndef CONFIG_ARDUINO_TICK
269-
# define CONFIG_ARDUINO_TICK (16)
287+
# define CONFIG_ARDUINO_TICK (15)
270288
#endif
271289

272290

273-
/* Timer Options */
291+
/* Timer Config */
292+
274293
// #define RT_USING_TIMER_SOFT
275294
// #define RT_TIMER_THREAD_PRIO (4)
276295
// #define RT_TIMER_THREAD_STACK_SIZE (512)
277296

278297

279-
/* Utility Options */
298+
/* Utility Config */
299+
280300
#define RT_USING_DEVICE /* Required by IPC, DRV */
281-
#define RT_USING_SEMAPHORE /* Required by FINSH */
282301
#define RT_USING_MUTEX /* Required by DFS, DRV */
283-
#define RT_USING_EVENT /* Required by ? */
284-
#define RT_USING_MAILBOX /* Required by ? */
302+
#define RT_USING_SEMAPHORE /* Required by FINSH */
303+
#define RT_USING_MAILBOX /* Required by GUI */
285304
// #define RT_USING_MESSAGEQUEUE /* Required by ? */
305+
// #define RT_USING_EVENT /* Required by ? */
286306
// #define RT_USING_SIGNALS /* Required by ? */
287307
// #define RT_USING_HOOK
288308
// #define RT_USING_IDLE_HOOK
289309

290310

291-
/* Memory Management Options */
311+
/* Memory Management Config */
312+
292313
#define RT_USING_MEMPOOL /* Required by SIG, GUI */
293314
// #define RT_USING_MEMHEAP
294315
#define RT_USING_HEAP
295316
#define RT_USING_SMALL_MEM
296317

297318

298-
/* Console Options */
319+
/* Console Config */
320+
299321
#if (CONFIG_USING_CONSOLE)
300322
# define RT_USING_CONSOLE
301323
# define RT_CONSOLEBUF_SIZE (128)
302324
#endif /* CONFIG_USING_CONSOLE */
303325

304326

305-
/* FinSH Options */
327+
/* FinSH Config */
328+
306329
#if (CONFIG_USING_FINSH)
307330
#define RT_USING_FINSH
308331
# if (CONFIG_USING_MSH)
@@ -311,30 +334,34 @@
311334
# endif
312335
#define FINSH_USING_DESCRIPTION
313336
#define FINSH_USING_HISTORY
314-
#define FINSH_THREAD_PRIORITY (20)
315-
#define FINSH_THREAD_STACK_SIZE (4 * 1024)
337+
#define FINSH_THREAD_PRIORITY ((RT_THREAD_PRIORITY_MAX >> 1) + (RT_THREAD_PRIORITY_MAX >> 3))
338+
#define FINSH_THREAD_STACK_SIZE (2 * 512)
316339
#endif /* CONFIG_USING_FINSH */
317340

318341

319-
/* DFS Options */
342+
/* File System Config */
343+
320344
#if (CONFIG_USING_SPISD)
321345
# define RT_USING_DFS
322-
// # define RT_USING_DFS_MNTTABLE
346+
// # define RT_USING_DFS_MNTTABLE /* Mount table */
323347
# define RT_USING_DFS_ELMFAT
324348
# define DFS_USING_WORKDIR
325-
// # define DFS_FILESYSTEMS_MAX (2) /* Max number of fs */
326-
// # define DFS_FD_MAX (4) /* Max number of open file */
349+
# define DFS_FILESYSTEMS_MAX (1) /* Max number of fs */
350+
# define DFS_FD_MAX (4) /* Max number of open file */
327351
# define RT_DFS_ELM_CODE_PAGE 437 /* (xxx) is wrong -_-! */
328-
// # define RT_DFS_ELM_LFN_UNICODE
329-
// # define RT_DFS_ELM_USE_EXFAT
352+
# if (CONFIG_USING_EXFAT)
353+
# define RT_DFS_ELM_USE_EXFAT
354+
# endif
330355
# if defined(RT_DFS_ELM_USE_EXFAT) || (RT_DFS_ELM_CODE_PAGE >= 900)
331356
# define RT_DFS_ELM_USE_LFN (2)
332357
# define RT_DFS_ELM_MAX_LFN (255)
358+
// # define RT_DFS_ELM_LFN_UNICODE
333359
# endif /* defined(RT_DFS_ELM_USE_EXFAT) || (RT_DFS_ELM_CODE_PAGE >= 900) */
334360
#endif /* CONFIG_USING_SPISD */
335361

336362

337-
/* Unsupported Options */
363+
/* Unsupported Config */
364+
338365
#ifdef FINSH_USING_SYMTAB
339366
# undef FINSH_USING_SYMTAB /* Reason: no access to linker script */
340367
#endif

0 commit comments

Comments
 (0)