Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Examples): Add CLI Library to MSDK #679

Merged
merged 44 commits into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
23354ca
README.md change
Jun 21, 2023
b0d72fc
cli changes
Jun 22, 2023
61de614
Bugs removed
Jun 23, 2023
86e191b
Working CLI
Jul 3, 2023
e1a9ff7
Interrupt based uart
Jul 3, 2023
d957156
Enable SD Card detection
Jul 5, 2023
da80146
Enter bug Fix
Jul 5, 2023
41ba63d
Compatility with SDHC functions tested
Jul 13, 2023
4483da7
tested with new functionality
Jul 13, 2023
2a9d668
User prompt
Jul 13, 2023
fb2760b
User prompt
Jul 17, 2023
8dcfc57
Doxygen comments and Userguide update
Jul 19, 2023
0f2d99e
Resolve conflicts, fix Typos
Jul 19, 2023
32dc919
Merge branch 'main' into fix/msdk-1197
Suraj-Ajjampur Jul 19, 2023
3581e0f
clang-format bot reformatting.
Suraj-Ajjampur Jul 19, 2023
180bac7
CLI library ReadMe and CLI_UART added
Jul 24, 2023
2c7c180
Merge branch 'fix/msdk-1197' of https://github.com/Suraj-Ajjampur/msd…
Jul 24, 2023
f39afce
Readme cli and cli_uart
Jul 24, 2023
d2d8faa
clang-format bot reformatting.
Suraj-Ajjampur Jul 24, 2023
ad03f20
Refactor CLI driver (pt. 1)
Jacob-Scheiffler Sep 11, 2023
b74eeef
Merge branch 'main' into fix/msdk-1197
Jacob-Scheiffler Sep 11, 2023
47499dd
Refactor CLI library (pt. 2)
Jacob-Scheiffler Sep 11, 2023
2e8b0b5
Refactor CLI library (pt 3)
Jacob-Scheiffler Sep 12, 2023
a7ac928
Update SDHC_FTHR example to use refactored CLI library
Jacob-Scheiffler Sep 12, 2023
399ef10
Remove the user-cli header file include in cli.c
Jacob-Scheiffler Sep 12, 2023
cd86680
Update CLI library README
Jacob-Scheiffler Sep 12, 2023
e0b27f6
Revert SDHC_FTHR example settings.json file to standard.
Jacob-Scheiffler Sep 13, 2023
ebf80d3
Refactor CLI library (pt 4)
Jacob-Scheiffler Sep 13, 2023
0d54953
Update SDHC_FTHR example to use refactored CLI library
Jacob-Scheiffler Sep 13, 2023
c0bdda6
Make requested changes to CLI library
Jacob-Scheiffler Sep 14, 2023
24399f3
Update CLI README according to most recent changes in the CLI source.
Jacob-Scheiffler Sep 14, 2023
6c4afa5
Resolve linter errors
Jacob-Scheiffler Sep 14, 2023
4c54fb2
Update CLI library README
Jacob-Scheiffler Sep 14, 2023
2ef153d
Resolve clang-format errors
Jacob-Scheiffler Sep 14, 2023
b03762d
Resolve linter errors (pt. 2)
Jacob-Scheiffler Sep 14, 2023
cc71c8f
Adding ability to select whether CLI handler is defined in applicatio…
Jacob-Scheiffler Sep 20, 2023
86a1464
Merge branch 'main' into fix/msdk-1197
Jacob-Scheiffler Sep 20, 2023
d90901f
Resolve clang-format errors
Jacob-Scheiffler Sep 20, 2023
e2e16e7
Merge branch 'fix/msdk-1197' of github.com:Suraj-Ajjampur/msdk into f…
Jacob-Scheiffler Sep 20, 2023
836d635
Update SDHC_FTHR examples to be compatible with latest CLI changes
Jacob-Scheiffler Sep 20, 2023
8d621d8
Update documentation, add LIB_CLI build toggle, tweak makefiles
Jake-Carter Sep 20, 2023
375ad19
Update project files
Jake-Carter Sep 20, 2023
37c85d0
Add CLI readme to UG, format tweaking
Jake-Carter Sep 20, 2023
1d60354
Re-add MSDKGen missed ipath/vpaths
Jake-Carter Sep 20, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions Examples/MAX78000/SDHC_FTHR/.vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,20 @@
"${config:MAXIM_PATH}/Libraries/SDHC/ff14/Source"
],
"C_Cpp.default.defines": [

"${config:board}",
"TARGET=${config:target}",
"TARGET_REV=0x4131",
"__GNUC__"
],
"C_Cpp.default.forcedInclude": [
"${workspaceFolder}/build/project_defines.h"
]
"files.associations": {
Jacob-Scheiffler marked this conversation as resolved.
Show resolved Hide resolved
"stdint.h": "c",
"cli.h": "c",
"sdhc.h": "c",
"user-cli.h": "c",
"uart.h": "c",
"nvic_table.h": "c",
"cstdlib": "c",
"adc_reva.h": "c"
}
}

92 changes: 91 additions & 1 deletion Examples/MAX78000/SDHC_FTHR/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## Description

This example demonstrates the SDHC FAT Filesystem. The terminal prompts with a list of user-selectable tasks to run on the inserted Micro SD Card.

## Software

### Project Usage
Expand All @@ -8,4 +10,92 @@ Universal instructions on building, flashing, and debugging this project can be

### Project-Specific Build Notes

* This project comes pre-configured for the MAX78000EVKIT. See [Board Support Packages](https://analog-devices-msdk.github.io/msdk/USERGUIDE/#board-support-packages) in the UG for instructions on changing the target board.
* This project comes pre-configured for the MAX78000FTHR. See [Board Support Packages](https://analog-devices-msdk.github.io/msdk/USERGUIDE/#board-support-packages) in the UG for instructions on changing the target board.

## Required Connections

- Connect a USB cable between the PC and the CN1 (USB/PWR) connector.
- Open a terminal application on the PC and connect to the EV kit's console UART at 115200, 8-N-1.
- Insert the SD card into the Micro SD Card Connector.

## Expected Output

```
***** MAX78000 SDHC FAT Filesystem Example *****
Card inserted.
$ Help

Size --> Find the Size of the SD Card and Free Space
Format --> Format the Card
Mount --> Manually Mount Card
ls --> list the contents of the current directory
mkdir --> Create a directory
file_create --> Create a file of random data
cd --> Move into a directory
add_data --> Add random Data to an Existing File
Del --> Delete a file
FatFs --> Format Card and Run Example of FatFS Operations
Unmount --> Unmount card
Help --> Prints a help message with info about all of the supported commands.
$ SIZE
SD card mounted.
Disk Size: 31163072 bytes
Available: 31163008 bytes
$ Format


*****THE DRIVE WILL BE FORMATTED IN 5 SECONDS*****
**************PRESS ANY KEY TO ABORT**************

FORMATTING DRIVE
Drive formatted.
SD card mounted.
SD card unmounted.
$ mount
SD card mounted.
$ mkdir Analog_Devices
Creating directory...
Directory Analog_Devices created.
$ cd Analog_Devices
Changed to Analog_Devices
$ file_create Maxim 30
Creating file Maxim with length 30
File opened!
30 bytes written to file!
File Closed!
$ add_data Maxim 25
File opened!
25 bytes written to file
File closed.
$ ls
Listing Contents of 0:/Analog_Devices -
0:/Analog_Devices/Maxim

Finished listing contents
$ Del Maxim
Deleted file Maxim
$ fatfs


*****THE DRIVE WILL BE FORMATTED IN 5 SECONDS*****
**************PRESS ANY KEY TO ABORT**************

FORMATTING DRIVE
Drive formatted.
SD card mounted.
SD card unmounted.
SD card mounted.
SD Card Opened!
File opened!
256 bytes written to file!
File Closed!
Creating Directory...
Renaming File...
Attempting to read back file...
Read Back 256 bytes
Message: StiUH7-HxP!fffB,q.DqMnI2nvSnchst.ZaLTpG'w8I7Tg0,l6VVkEsehp#IHSMZN94WDc'N#-0qkBlAil,'#DvMJZ!zzf,j?Lm,H5cbfFfVNHUlPF9GsTWbrop0EG7VV57qZZzjdvzJH5Xh2'82'fz9t#R,kzoaqYBJVRhrlD5W1mZItggYqyIICUvWOOppJQIVvt.BR0Vy4#YwqiNYj'jYnX8j7ePtuzJO?t-sTCGvibwYn81?Sutq'Q0s7udL
File Closed!
$ unmount
SD card unmounted.
```

85 changes: 85 additions & 0 deletions Examples/MAX78000/SDHC_FTHR/include/sdhc.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
/******************************************************************************
* Copyright (C) 2023 Maxim Integrated Products, Inc., All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
* OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Maxim Integrated
* Products, Inc. shall not be used except as stated in the Maxim Integrated
* Products, Inc. Branding Policy.
*
* The mere transfer of this software does not imply any licenses
* of trade secrets, proprietary technology, copyrights, patents,
* trademarks, maskwork rights, or any other form of intellectual
* property whatsoever. Maxim Integrated Products, Inc. retains all
* ownership rights.
*
******************************************************************************/
#ifndef SDHC_HEADER
#define SDHC_HEADER

/***** Includes *****/
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>

#include "board.h"
#include "mxc_delay.h"
#include "mxc_device.h"
#include "gpio.h"
#include "uart.h"

#include "ff.h"
#include "cli.h"

/***** Definitions *****/

#define STRINGIFY(x) #x
#define TOSTRING(x) STRINGIFY(x)
#define MAXLEN 256

/***** FUNCTION PROTOTYPES *****/

void generateMessage(unsigned length);

int mount();

int umount();

int formatSDHC();

int getSize();

int ls();

int createFile(char *file_name, unsigned int length);

int appendFile(char *file_name, unsigned int length);

int mkdir(char *dir_name);

int cd(char *dir_name);

int delete (char *file_name);

int example();

void waitCardInserted();

#endif //SDHC_HEADER
Loading