Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
- FinSH is retired by upstream
- Upgrade FatFs from R0.13c to R0.14b
- Tested with Arduino DUE
  • Loading branch information
onelife committed May 15, 2022
1 parent 2906ad8 commit a56779a
Show file tree
Hide file tree
Showing 166 changed files with 13,995 additions and 15,405 deletions.
71 changes: 15 additions & 56 deletions examples/FinSH/FinSH.ino
Original file line number Diff line number Diff line change
Expand Up @@ -6,66 +6,27 @@
#include <rtt.h>

/* ATTENTION
Please append your new shell commands and variables to "shell_cmd.h" and
"shell_var.h".
- Please enable "CONFIG_USING_FINSH" in "rtconfig.h"
- Please add new shell commands to "shell_cmd.h".
*/

/* NOTES
When using FinSH without MSH (CONFIG_USING_FINSH == 1 &&
CONFIG_USING_MSH == 0):
- please append the following line to "shell_cmd.h":
ADD_FINSH_CMD(led, Turn on/off builtin LED, led, rt_uint32_t, rt_uint32_t id, rt_uint8_t state)
- and append the following 2 lines to "shell_var.h"
ADD_SHELL_VAR(id, LED ID, led_id, finsh_type_uint)
ADD_SHELL_VAR(state, LED state, led_state, finsh_type_uchar)
After uploaded, please send the following command through "Serial Monitor"
and observe the output:
led(0, 1)
led(0, 0)
led(id, state)
state
state=0
led(id, state)
*/

/* NOTES
When using FinSH with MSH (default, CONFIG_USING_FINSH == 1 &&
CONFIG_USING_MSH == 1):
- please append the following line to "shell_cmd.h":
ADD_MSH_CMD(led, Turn on/off builtin LED, led, int, int argc, char **argv)
- due to MSH doesn't support shell variables, "ADD_SHELL_VAR" has no effect
After uploaded, please send the following command through "Serial Monitor"
and observe the output:
led 0, 1, 2
led 1, 1
led 0, 1
- Using "MSH_CMD_EXPORT_ALIAS" macro to export shell command with the following format:
MSH_CMD_EXPORT_ALIAS(function_name, command_name, command description)
- Using "ADD_MSH_CMD" macro to add shell command to system with the following format:
ADD_MSH_CMD(function_name)
- Please insert the following line to "shell_cmd.h":
ADD_MSH_CMD(led)
After uploaded, please send the following command through "Serial Monitor" and observe the output:
led 0 1 2
led 1 1
led 0 1
*/

extern "C" {

#if !CONFIG_USING_MSH

rt_uint32_t led_id = 0;
rt_uint32_t led_state = 1;

rt_uint32_t led(rt_uint32_t id, rt_uint32_t state) {
rt_kprintf("led%d=%d\n", id, state);
if (id != 0) {
return 1;
}
if (state) {
digitalWrite(LED_BUILTIN, HIGH);
} else {
digitalWrite(LED_BUILTIN, LOW);
}
return 0;
}

#else /* !CONFIG_USING_MSH */

int led(int argc, char **argv) {
int led_set(int argc, char **argv) {
// argc - the number of arguments
// argv[0] - command name, e.g. "led"
// argv[n] - nth argument in the type of char array
Expand Down Expand Up @@ -93,10 +54,8 @@ extern "C" {
}
return 0;
}

#endif

}
MSH_CMD_EXPORT_ALIAS(led_set, led, Turn on/off builtin LED.);

void setup() {
pinMode(LED_BUILTIN, OUTPUT);
Expand Down
4 changes: 2 additions & 2 deletions examples/HelloMo/hello_mo.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ int say_hello(unsigned char argc, char **argv) {
}

void module_init(void *param) {
rt_dlmodule_t *self = (rt_dlmodule_t *)param;
struct rt_dlmodule *self = (struct rt_dlmodule *)param;

rt_kprintf("%s init\n", self->parent.name);
}

void module_cleanup(void *param) {
rt_dlmodule_t *self = (rt_dlmodule_t *)param;
struct rt_dlmodule *self = (struct rt_dlmodule *)param;

rt_kprintf("%s cleanup\n", self->parent.name);
}
2 changes: 1 addition & 1 deletion examples/HelloMo/load_mo.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "mo.h"

int load_hello(unsigned char argc, char **argv) {
rt_dlmodule_t *hello;
struct rt_dlmodule *hello;
int (*say_hello)(unsigned char argc, char **argv);
char *param[2];
(void)argc;
Expand Down
1 change: 0 additions & 1 deletion keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ rt_thread_mdelay KEYWORD2
rt_thread_control KEYWORD2
rt_thread_suspend KEYWORD2
rt_thread_resume KEYWORD2
rt_thread_timeout KEYWORD2
rt_thread_sleep KEYWORD2

#######################################
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=RT-Thread
version=0.9.4
version=1.0.0
author=onelife <[email protected]>, Bernard Xiong <[email protected]>
maintainer=onelife <[email protected]>
sentence=Real Time Operating System porting for Arduino SAM and SAMD boards
Expand Down
2 changes: 2 additions & 0 deletions src/components/arduino/drv_iic_ft6206.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ static rt_err_t ft_read_data(struct bsp_ft_contex *ctx) {
(CONFIG_GUI_WIDTH > x) ? CONFIG_GUI_WIDTH - x : 0,
(CONFIG_GUI_HIGH > y) ? CONFIG_GUI_HIGH - y : 0);
}
(void)x;
(void)y;

return RT_EOK;
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/arduino/drv_rtc.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

/* Includes ------------------------------------------------------------------*/
/* Exported defines ----------------------------------------------------------*/
#define RTC_NAME "RTC"
#define RTC_NAME "rtc"

/* Exported types ------------------------------------------------------------*/
struct bsp_rtc_contex {
Expand Down
3 changes: 2 additions & 1 deletion src/components/arduino/drv_spiili.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,11 @@ static const rt_uint8_t init_code[] = {
static const struct rt_device_graphic_info disp_info = {
.pixel_format = RTGRAPHIC_PIXEL_FORMAT_RGB565,
.bits_per_pixel = 16,
.reserved = 0,
.pitch = 0,
.width = CONFIG_GUI_WIDTH,
.height = CONFIG_GUI_HIGH,
.framebuffer = RT_NULL,
.smem_len = 0,
};

static struct rtgui_graphic_driver_ops disp_ops = {
Expand Down
8 changes: 5 additions & 3 deletions src/components/arduino/drv_spisd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -939,13 +939,15 @@ rt_err_t bsp_hw_spiSd_init(void) {
******************************************************************************/
#ifdef RT_USING_FINSH

rt_err_t list_sd(void) {
int list_sd(int argc, char **argv) {
struct bsp_sd_contex *ctx = SD_CTX();
rt_uint8_t buf_res[16];
struct sd_register_cid *cid = (sd_register_cid *)buf_res;
struct rt_device_blk_geometry geometry;
rt_uint32_t temp;
rt_err_t ret;
int ret;
(void)argc;
(void)argv;

if (RT_EOK != (ret = rt_device_open(&ctx->dev, RT_DEVICE_OFLAG_RDWR))) {
rt_kprintf("Error: open failed!\n");
Expand Down Expand Up @@ -1008,7 +1010,7 @@ rt_err_t list_sd(void) {

return RT_EOK;
}
FINSH_FUNCTION_EXPORT(list_sd, show SD information.)
MSH_CMD_EXPORT(list_sd, Show SD information.)
#endif /* RT_USING_FINSH */

/***************************************************************************//**
Expand Down
29 changes: 29 additions & 0 deletions src/components/dfs/filesystems/elmfat/00history.txt
Original file line number Diff line number Diff line change
Expand Up @@ -328,3 +328,32 @@ R0.13c (October 14, 2018)
Fixed creating a sub-directory in the fragmented sub-directory on the exFAT volume collapses FAT chain of the parent directory. (appeared at R0.12)
Fixed f_getcwd() cause output buffer overrun when the buffer has a valid drive number. (appeared at R0.13b)



R0.14 (October 14, 2019)
Added support for 64-bit LBA and GUID partition table (FF_LBA64 = 1)
Changed some API functions, f_mkfs() and f_fdisk().
Fixed f_open() function cannot find the file with file name in length of FF_MAX_LFN characters.
Fixed f_readdir() function cannot retrieve long file names in length of FF_MAX_LFN - 1 characters.
Fixed f_readdir() function returns file names with wrong case conversion. (appeared at R0.12)
Fixed f_mkfs() function can fail to create exFAT volume in the second partition. (appeared at R0.12)


R0.14a (December 5, 2020)
Limited number of recursive calls in f_findnext().
Fixed old floppy disks formatted with MS-DOS 2.x and 3.x cannot be mounted.
Fixed some compiler warnings.



R0.14b (April 17, 2021)
Made FatFs uses standard library <string.h> for copy, compare and search instead of built-in string functions.
Added support for long long integer and floating point to f_printf(). (FF_STRF_LLI and FF_STRF_FP)
Made path name parser ignore the terminating separator to allow "dir/".
Improved the compatibility in Unix style path name feature.
Fixed the file gets dead-locked when f_open() failed with some conditions. (appeared at R0.12a)
Fixed f_mkfs() can create wrong exFAT volume due to a timing dependent error. (appeared at R0.12)
Fixed code page 855 cannot be set by f_setcp().
Fixed some compiler warnings.


2 changes: 1 addition & 1 deletion src/components/dfs/filesystems/elmfat/00readme.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FatFs Module Source Files R0.13c
FatFs Module Source Files R0.14b


FILES
Expand Down
Loading

0 comments on commit a56779a

Please sign in to comment.