Fixes to RP2040 SMART flash and documentation

This commit is contained in:
curuvar 2022-09-05 14:34:58 -04:00 committed by Xiang Xiao
parent ac4af3ff49
commit 89d3ba44ca
17 changed files with 60 additions and 49 deletions

View File

@ -156,6 +156,12 @@ nsh
Basic NuttShell configuration (console enabled in UART0, at 115200 bps).
nsh-flash
---------
Basic NuttShell configuration (console enabled in UART0, at 115200 bps
with SMART flash filesystem.
nshsram
-------

View File

@ -132,6 +132,12 @@ nsh
Basic NuttShell configuration (console enabled in UART0, at 115200 bps).
nsh-flash
---------
Basic NuttShell configuration (console enabled in UART0, at 115200 bps
with SMART flash filesystem.
nshsram
-------

View File

@ -100,6 +100,12 @@ nsh
Basic NuttShell configuration (console enabled in UART1, at 115200 bps).
nsh-flash
---------
Basic NuttShell configuration (console enabled in UART0, at 115200 bps
with SMART flash filesystem.
nshsram
-------

View File

@ -97,6 +97,12 @@ nsh
Basic NuttShell configuration (console enabled in UART0, at 115200 bps).
nsh-flash
---------
Basic NuttShell configuration (console enabled in UART0, at 115200 bps
with SMART flash filesystem.
nshsram
-------

View File

@ -1,5 +1,5 @@
===============================
Raspberry Pi Pico
Raspberry Pi Pico W
===============================
The `Raspberry Pi Pico <https://www.raspberrypi.com/products/raspberry-pi-pico/>`_ is a general purpose board supplied by
@ -38,6 +38,7 @@ Buttons and LEDs
================
LED controlled by GPIO0 of the wireless chip (not the RP2040 processor).
Use rp2040_extra_gpio_put(0,value) to control this LED.
A BOOTSEL button, which if held down when power is first
applied to the board, will cause the RP2040 to boot into programming
@ -179,6 +180,12 @@ nsh
Basic NuttShell configuration (console enabled in UART0, at 115200 bps).
nsh-flash
---------
Basic NuttShell configuration (console enabled in UART0, at 115200 bps
with SMART flash filesystem.
nshsram
-------

View File

@ -158,6 +158,12 @@ nsh
Basic NuttShell configuration (console enabled in UART0, at 115200 bps).
nsh-flash
---------
Basic NuttShell configuration (console enabled in UART0, at 115200 bps
with SMART flash filesystem.
nshsram
-------

View File

@ -71,7 +71,7 @@ Defconfigs
- nsh
Minimum configuration with NuttShell
- nsh_flash
- nsh-flash
NuttX shell with SMART flash filesystem.
- nshsram

View File

@ -70,7 +70,7 @@ Defconfigs
- nsh
Minimum configuration with NuttShell
- nsh_flash
- nsh-flash
NuttX shell with SMART flash filesystem.
- nshsram

View File

@ -65,7 +65,7 @@ Defconfigs
- nsh
Minimum configuration with NuttShell
- nsh_flash
- nsh-flash
NuttX shell with SMART flash filesystem.
- nshsram

View File

@ -69,7 +69,7 @@ Defconfigs
- nsh
Minimum configuration with NuttShell
- nsh_flash
- nsh-flash
NuttX shell with SMART flash filesystem.
- nshsram

View File

@ -72,7 +72,7 @@ Defconfigs
- nsh
Minimum configuration with NuttShell
- nsh_flash
- nsh-flash
NuttX shell with SMART flash filesystem.
- nshsram

View File

@ -71,7 +71,7 @@ Defconfigs
- nsh
Minimum configuration with NuttShell
- nsh_flash
- nsh-flash
NuttX shell with SMART flash filesystem.
- nshsram

View File

@ -129,7 +129,7 @@ int process_f2_frame_header(FAR bcmf_interface_dev_t *gbus,
****************************************************************************/
/****************************************************************************
* Name: read_f2_frame
* Name: bcmf_gspi_read_f2_frame
*
* Description:
* Read and process an F2 frame.

View File

@ -32,7 +32,7 @@
****************************************************************************/
/****************************************************************************
* Name: read_f2_frame
* Name: bcmf_gspi_read_f2_frame
*
* Description:
* Read and process an F2 frame.

View File

@ -199,15 +199,21 @@
#ifdef CONFIG_SMARTFS_ALIGNED_ACCESS
# define SMARTFS_NEXTSECTOR(h) (smartfs_rdle16(h->nextsector))
# define SMARTFS_SET_NEXTSECTOR(h, v) smartfs_wrle16(h->nextsector, v)
# define SMARTFS_SET_NEXTSECTOR(h, v) smartfs_wrle16(h->nextsector, \
(uint16_t)(v))
# define SMARTFS_USED(h) (smartfs_rdle16(h->used))
# define SMARTFS_SET_USED(h, v) smartfs_wrle16(h->used, v)
# define SMARTFS_SET_USED(h, v) smartfs_wrle16(h->used, \
(uint16_t)(v))
#else
# define SMARTFS_NEXTSECTOR(h) (*((uint16_t *)h->nextsector))
# define SMARTFS_SET_NEXTSECTOR(h, v) ((*((uint16_t *)h->nextsector)) = v)
# define SMARTFS_SET_NEXTSECTOR(h, v) ((*((uint16_t *)h->nextsector)) = \
(uint16_t)(v))
# define SMARTFS_USED(h) (*((uint16_t *)h->used))
# define SMARTFS_SET_USED(h, v) ((*((uint16_t *)h->used)) = v)
# define SMARTFS_SET_USED(h, v) ((*((uint16_t *)h->used)) = \
(uint16_t)(v))
#endif
#ifdef CONFIG_MTD_SMART_ENABLE_CRC

View File

@ -45,10 +45,6 @@
#include "smartfs.h"
#ifdef CONFIG_DEBUG_FS_INFO
# include <stdio.h>
#endif
/****************************************************************************
* Private Type
****************************************************************************/
@ -532,8 +528,6 @@ static ssize_t smartfs_read(FAR struct file *filep, char *buffer,
DEBUGASSERT(filep->f_priv != NULL && filep->f_inode != NULL);
finfo("Reading %u bytes\n", (unsigned) buflen);
/* Recover our private data from the struct file instance */
sf = filep->f_priv;
@ -639,18 +633,6 @@ static ssize_t smartfs_read(FAR struct file *filep, char *buffer,
/* Return the number of bytes we read */
#ifdef CONFIG_DEBUG_FS_INFO
finfo("Read %lu bytes:", bytesread);
for (uint32_t i = 0; i < bytesread; ++i)
{
if ((i & 0x0f) == 0) printf("\n ");
printf("%02x, ", buffer[i]);
}
printf("\n");
#endif
ret = bytesread;
errout_with_semaphore:
@ -675,18 +657,6 @@ static ssize_t smartfs_write(FAR struct file *filep, const char *buffer,
DEBUGASSERT(filep->f_priv != NULL && filep->f_inode != NULL);
#ifdef CONFIG_DEBUG_FS_INFO
finfo("Writing %lu bytes:", (uint32_t)buflen);
for (uint32_t i = 0; i < buflen; ++i)
{
if ((i & 0x0f) == 0) printf("\n ");
printf("%02x, ", buffer[i]);
}
printf("\n");
#endif
/* Recover our private data from the struct file instance */
sf = filep->f_priv;
@ -882,7 +852,7 @@ static ssize_t smartfs_write(FAR struct file *filep, const char *buffer,
/* Copy the new sector to the old one and chain it */
header = (struct smartfs_chain_header_s *) sf->buffer;
SMARTFS_SET_NEXTSECTOR(header, (uint16_t) ret);
SMARTFS_SET_NEXTSECTOR(header, ret);
/* Now sync the file to write this sector out */
@ -938,7 +908,7 @@ static ssize_t smartfs_write(FAR struct file *filep, const char *buffer,
/* Copy the new sector to the old one and chain it */
header = (struct smartfs_chain_header_s *) fs->fs_rwbuffer;
SMARTFS_SET_NEXTSECTOR(header, (uint16_t) ret);
SMARTFS_SET_NEXTSECTOR(header, ret);
readwrite.offset = offsetof(struct smartfs_chain_header_s,
nextsector);
readwrite.buffer = (uint8_t *) header->nextsector;
@ -971,8 +941,6 @@ static ssize_t smartfs_write(FAR struct file *filep, const char *buffer,
ret = byteswritten;
finfo("Wrote %u bytes\n", (unsigned) byteswritten);
errout_with_semaphore:
smartfs_semgive(fs);
return ret;

View File

@ -2031,7 +2031,7 @@ int smartfs_extendfile(FAR struct smartfs_mountpt_s *fs,
/* Copy the new sector to the old one and chain it */
header = (struct smartfs_chain_header_s *) sf->buffer;
SMARTFS_SET_NEXTSECTOR(header, (uint16_t)ret);
SMARTFS_SET_NEXTSECTOR(header, ret);
/* Now sync the file to write this sector out */
@ -2087,7 +2087,7 @@ int smartfs_extendfile(FAR struct smartfs_mountpt_s *fs,
/* Copy the new sector to the old one and chain it */
header = (struct smartfs_chain_header_s *)fs->fs_rwbuffer;
SMARTFS_SET_NEXTSECTOR(header, (uint16_t)ret);
SMARTFS_SET_NEXTSECTOR(header, ret);
readwrite.offset = offsetof(struct smartfs_chain_header_s,
nextsector);