Skip to content

Commit

Permalink
STORAGE, Boot sector: read, check, write. Temporary remove USB MSD
Browse files Browse the repository at this point in the history
  • Loading branch information
polesskiy-dev committed Sep 14, 2023
1 parent 1c0d1e9 commit ece90ba
Show file tree
Hide file tree
Showing 49 changed files with 2,642 additions and 837 deletions.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
$(MP_EXTRA_CC_PRE) -g -x c -c -mprocessor=$(MP_PROCESSOR_OPTION) -ffunction-sections -fdata-sections -fno-common -I"../src" -I"../src/config/default" -I"../src/config/default/library/cryptoauthlib" -I"../src/config/default/library/cryptoauthlib/crypto" -I"../src/config/default/library/cryptoauthlib/pkcs11" -I"../src/packs/ATSAMD21E18A_DFP" -I"../src/packs/CMSIS/" -I"../src/packs/CMSIS/CMSIS/Core/Include" -Werror -Wall -DXPRJ_default=$(CND_CONF) $(COMPARISON_BUILD) -mdfp="${DFP_DIR}/samd21a" ${PACK_COMMON_OPTIONS} /Users/artempolisskyi/projects/iot-risk-data-logger-nfc-samd21/firmware/src/config/default/usb/src/usb_device_msd.c
$(MP_EXTRA_CC_PRE) -g -x c -c -mprocessor=$(MP_PROCESSOR_OPTION) -ffunction-sections -fdata-sections -fno-common -I"../src" -I"../src/config/default" -I"../src/config/default/library/cryptoauthlib" -I"../src/config/default/library/cryptoauthlib/crypto" -I"../src/config/default/library/cryptoauthlib/pkcs11" -I"../src/packs/ATSAMD21E18A_DFP" -I"../src/packs/CMSIS/" -I"../src/packs/CMSIS/CMSIS/Core/Include" -Werror -Wall -DXPRJ_default=$(CND_CONF) $(COMPARISON_BUILD) -mdfp="${DFP_DIR}/samd21a" ${PACK_COMMON_OPTIONS} /Users/artempolisskyi/projects/iot-risk-data-logger-nfc-samd21/firmware/src/storage/storage_manager.c
Original file line number Diff line number Diff line change
@@ -1 +1 @@
$(MP_EXTRA_CC_PRE) -g -D__DEBUG -x c -c -mprocessor=$(MP_PROCESSOR_OPTION) -ffunction-sections -fdata-sections -fno-common -I"../src" -I"../src/config/default" -I"../src/config/default/library/cryptoauthlib" -I"../src/config/default/library/cryptoauthlib/crypto" -I"../src/config/default/library/cryptoauthlib/pkcs11" -I"../src/packs/ATSAMD21E18A_DFP" -I"../src/packs/CMSIS/" -I"../src/packs/CMSIS/CMSIS/Core/Include" -Werror -Wall -DXPRJ_default=$(CND_CONF) $(COMPARISON_BUILD) -mdfp="${DFP_DIR}/samd21a" ${PACK_COMMON_OPTIONS} /Users/artempolisskyi/projects/iot-risk-data-logger-nfc-samd21/firmware/src/config/default/usb/src/usb_device_msd.c
$(MP_EXTRA_CC_PRE) -g -D__DEBUG -x c -c -mprocessor=$(MP_PROCESSOR_OPTION) -ffunction-sections -fdata-sections -fno-common -I"../src" -I"../src/config/default" -I"../src/config/default/library/cryptoauthlib" -I"../src/config/default/library/cryptoauthlib/crypto" -I"../src/config/default/library/cryptoauthlib/pkcs11" -I"../src/packs/ATSAMD21E18A_DFP" -I"../src/packs/CMSIS/" -I"../src/packs/CMSIS/CMSIS/Core/Include" -Werror -Wall -DXPRJ_default=$(CND_CONF) $(COMPARISON_BUILD) -mdfp="${DFP_DIR}/samd21a" ${PACK_COMMON_OPTIONS} /Users/artempolisskyi/projects/iot-risk-data-logger-nfc-samd21/firmware/src/storage/storage_manager.c
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$(MP_EXTRA_CC_PRE) -g -x c -c -mprocessor=$(MP_PROCESSOR_OPTION) -ffunction-sections -fdata-sections -fno-common -I"../src" -I"../src/config/default" -I"../src/config/default/library/cryptoauthlib" -I"../src/config/default/library/cryptoauthlib/crypto" -I"../src/config/default/library/cryptoauthlib/pkcs11" -I"../src/packs/ATSAMD21E18A_DFP" -I"../src/packs/CMSIS/" -I"../src/packs/CMSIS/CMSIS/Core/Include" -Werror -Wall -DXPRJ_default=$(CND_CONF) $(COMPARISON_BUILD) -mdfp="${DFP_DIR}/samd21a" ${PACK_COMMON_OPTIONS} /Users/artempolisskyi/projects/iot-risk-data-logger-nfc-samd21/firmware/src/storage/storage_manager_fsm.c
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$(MP_EXTRA_CC_PRE) -g -D__DEBUG -x c -c -mprocessor=$(MP_PROCESSOR_OPTION) -ffunction-sections -fdata-sections -fno-common -I"../src" -I"../src/config/default" -I"../src/config/default/library/cryptoauthlib" -I"../src/config/default/library/cryptoauthlib/crypto" -I"../src/config/default/library/cryptoauthlib/pkcs11" -I"../src/packs/ATSAMD21E18A_DFP" -I"../src/packs/CMSIS/" -I"../src/packs/CMSIS/CMSIS/Core/Include" -Werror -Wall -DXPRJ_default=$(CND_CONF) $(COMPARISON_BUILD) -mdfp="${DFP_DIR}/samd21a" ${PACK_COMMON_OPTIONS} /Users/artempolisskyi/projects/iot-risk-data-logger-nfc-samd21/firmware/src/storage/storage_manager_fsm.c
398 changes: 205 additions & 193 deletions firmware/iot-risk-data-logger-nfc-samd21.X/nbproject/Makefile-default.mk

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#
#Tue Sep 12 23:19:49 CEST 2023
#Thu Sep 14 22:19:41 CEST 2023
default.languagetoolchain.version=4.30
default.Pack.dfplocation=/Applications/microchip/mplabx/v6.10/packs/Microchip/SAMD21_DFP/3.6.144
default.com-microchip-mplab-mdbcore-PK5Tool-PK5ToolImpl.md5=03e12bb97e05706420942b3ce207925c
conf.ids=default
default.languagetoolchain.dir=/Applications/microchip/xc32/v4.30/bin
default.com-microchip-mplab-nbide-toolchain-xc32-XC32LanguageToolchain.md5=453816bbff5fc8c544047982c7194139
host.id=0
configurations-xml=005596c708839c5ad7af2bc7356f4cd4
configurations-xml=98e060d8e4cb6d3a97a15e79232728d5
com-microchip-mplab-nbide-embedded-makeproject-MakeProject.md5=ff725c3d3fe40010a04a4bae132aaf51
proj.dir=/Users/artempolisskyi/projects/iot-risk-data-logger-nfc-samd21/firmware/iot-risk-data-logger-nfc-samd21.X
host.platform=mac
Original file line number Diff line number Diff line change
Expand Up @@ -113,16 +113,12 @@
</logicalFolder>
<logicalFolder name="f5" displayName="usb" projectFiles="true">
<logicalFolder name="f1" displayName="src" projectFiles="true">
<itemPath>../src/config/default/usb/src/usb_device_msd_local.h</itemPath>
<itemPath>../src/config/default/usb/src/usb_device_local.h</itemPath>
<itemPath>../src/config/default/usb/src/usb_device_mapping.h</itemPath>
<itemPath>../src/config/default/usb/src/usb_device_function_driver.h</itemPath>
<itemPath>../src/config/default/usb/src/usb_external_dependencies.h</itemPath>
<itemPath>../src/config/default/usb/src/usb_device_cdc_local.h</itemPath>
</logicalFolder>
<itemPath>../src/config/default/usb/usb_device_msd.h</itemPath>
<itemPath>../src/config/default/usb/usb_msd.h</itemPath>
<itemPath>../src/config/default/usb/scsi.h</itemPath>
<itemPath>../src/config/default/usb/usb_device.h</itemPath>
<itemPath>../src/config/default/usb/usb_common.h</itemPath>
<itemPath>../src/config/default/usb/usb_chapter_9.h</itemPath>
Expand Down Expand Up @@ -248,6 +244,10 @@
<itemPath>../src/sensors/sht3x-temperature-humidity/sht3x.h</itemPath>
</logicalFolder>
</logicalFolder>
<logicalFolder name="storage" displayName="storage" projectFiles="true">
<itemPath>../src/storage/storage_manager.h</itemPath>
<itemPath>../src/storage/storage_data.defs.h</itemPath>
</logicalFolder>
</logicalFolder>
<logicalFolder name="libraries" displayName="libraries" projectFiles="true">
<logicalFolder name="active-object-fsm"
Expand Down Expand Up @@ -507,7 +507,6 @@
</logicalFolder>
<logicalFolder name="f5" displayName="usb" projectFiles="true">
<logicalFolder name="f1" displayName="src" projectFiles="true">
<itemPath>../src/config/default/usb/src/usb_device_msd.c</itemPath>
<itemPath>../src/config/default/usb/src/usb_device.c</itemPath>
<itemPath>../src/config/default/usb/src/usb_device_cdc.c</itemPath>
<itemPath>../src/config/default/usb/src/usb_device_cdc_acm.c</itemPath>
Expand All @@ -519,8 +518,8 @@
<itemPath>../src/config/default/startup_xc32.c</itemPath>
<itemPath>../src/config/default/libc_syscalls.c</itemPath>
<itemPath>../src/config/default/tasks.c</itemPath>
<itemPath>../src/config/default/usb_device_init_data.c</itemPath>
<itemPath>../src/config/default/diskImage.c</itemPath>
<itemPath>../src/config/default/usb_device_init_data.c</itemPath>
</logicalFolder>
</logicalFolder>
<logicalFolder name="nfc" displayName="nfc" projectFiles="true">
Expand All @@ -535,6 +534,10 @@
<itemPath>../src/sensors/sht3x-temperature-humidity/sht3x_fsm.c</itemPath>
</logicalFolder>
</logicalFolder>
<logicalFolder name="storage" displayName="storage" projectFiles="true">
<itemPath>../src/storage/storage_manager.c</itemPath>
<itemPath>../src/storage/storage_manager_fsm.c</itemPath>
</logicalFolder>
<itemPath>../src/main.c</itemPath>
</logicalFolder>
<logicalFolder name="ExternalFiles"
Expand All @@ -560,7 +563,6 @@
<itemPath>../src/config/default/default.mhc/nvmctrl.yml</itemPath>
<itemPath>../src/config/default/default.mhc/drv_memory.yml</itemPath>
<itemPath>../src/config/default/default.mhc/usb_device_cdc.yml</itemPath>
<itemPath>../src/config/default/default.mhc/usb_device_msd.yml</itemPath>
<itemPath>../src/config/default/default.mhc/sys_debug.yml</itemPath>
<itemPath>../src/config/default/default.mhc/drv_i2c.yml</itemPath>
<itemPath>../src/config/default/default.mhc/settings.yml</itemPath>
Expand Down Expand Up @@ -860,7 +862,7 @@
<property key="communication.speed" value="2.000"/>
<property key="debugoptions.debug-startup" value="Use system settings"/>
<property key="debugoptions.reset-behaviour" value="Use system settings"/>
<property key="debugoptions.useswbreakpoints" value="false"/>
<property key="debugoptions.useswbreakpoints" value="true"/>
<property key="event.recorder.enabled" value="false"/>
<property key="event.recorder.scvd.files" value=""/>
<property key="hwtoolclock.frcindebug" value="false"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,7 @@
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group>
<file>file:/Users/artempolisskyi/projects/iot-risk-data-logger-nfc-samd21/firmware/src/sensors/sht3x-temperature-humidity/sht3x.c</file>
<file>file:/Users/artempolisskyi/projects/iot-risk-data-logger-nfc-samd21/firmware/src/sensors/sht3x-temperature-humidity/sht3x_fsm.c</file>
<file>file:/Users/artempolisskyi/projects/iot-risk-data-logger-nfc-samd21/firmware/src/config/default/peripheral/port/plib_port.h</file>
<file>file:/Users/artempolisskyi/projects/iot-risk-data-logger-nfc-samd21/firmware/src/config/common.defs.h</file>
<file>file:/Users/artempolisskyi/projects/iot-risk-data-logger-nfc-samd21/firmware/src/nfc/nfc.c</file>
<file>file:/Users/artempolisskyi/projects/iot-risk-data-logger-nfc-samd21/firmware/src/nfc/nfc.h</file>
<file>file:/Users/artempolisskyi/projects/iot-risk-data-logger-nfc-samd21/firmware/src/main.c</file>
<file>file:/Users/artempolisskyi/projects/iot-risk-data-logger-nfc-samd21/firmware/src/config/default/usb/src/usb_device.c</file>
<file>file:/Users/artempolisskyi/projects/iot-risk-data-logger-nfc-samd21/firmware/src/config/default/initialization.c</file>
<file>file:/Users/artempolisskyi/projects/iot-risk-data-logger-nfc-samd21/firmware/src/config/default/tasks.c</file>
<file>file:/Users/artempolisskyi/projects/iot-risk-data-logger-nfc-samd21/firmware/src/sensors/sht3x-temperature-humidity/sht3x.h</file>
<file>file:/Users/artempolisskyi/projects/iot-risk-data-logger-nfc-samd21/firmware/src/config/default/peripheral/tc/plib_tc3.c</file>
<file>file:/Users/artempolisskyi/projects/iot-risk-data-logger-nfc-samd21/firmware/src/nfc/nfc.config.h</file>
</group>
</open-files>
</project-private>
1 change: 1 addition & 0 deletions firmware/src/config/common.defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// global active objects IDs
typedef enum {
NO_ID,
STORAGE_AO_ID,
SHT3X_AO_ID,
NFC_AO_ID,
ACTIVE_OBJECTS_MAX
Expand Down
20 changes: 8 additions & 12 deletions firmware/src/config/default/configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,21 @@ extern "C" {
#define DRV_AT25DF_ERASE_BUFFER_SIZE 4096
#define DRV_AT25DF_CHIP_SELECT_PIN_IDX SYS_PORT_PIN_PA18

// FAT boot sector

// memory address of FAT12 header (10 * 256), 256K-4K=252K
#define DRV_MEMORY_BOOT_SECTOR_SIZE_PAGES (10)
#define DRV_MEMORY_BOOT_SECTOR_NVM_ADDRESS (0x40000 - DRV_MEMORY_BOOT_SECTOR_SIZE_PAGES * DRV_AT25DF_PAGE_SIZE)
#define DRV_MEMORY_BOOT_SECTOR_FLASH_ADDRESS (0)


// *****************************************************************************
// *****************************************************************************
// Section: Middleware & Other Library Configuration
// *****************************************************************************
// *****************************************************************************
/* Number of Endpoints used */
#define DRV_USBFSV1_ENDPOINTS_NUMBER 4
#define DRV_USBFSV1_ENDPOINTS_NUMBER 3

/* The USB Device Layer will not initialize the USB Driver */
#define USB_DEVICE_DRIVER_INITIALIZE_EXPLICIT
Expand Down Expand Up @@ -192,17 +199,6 @@ extern "C" {
/* Alignment for buffers that are submitted to USB Driver*/
#define USB_ALIGN __ALIGNED(CACHE_LINE_SIZE)

/* Maximum instances of MSD function driver */
#define USB_DEVICE_MSD_INSTANCES_NUMBER 1

#define USB_DEVICE_MSD_NUM_SECTOR_BUFFERS 1


/* Number of Logical Units */
#define USB_DEVICE_MSD_LUNS_NUMBER 1





// *****************************************************************************
Expand Down
2 changes: 1 addition & 1 deletion firmware/src/config/default/default.mhc/GraphSettings.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
format_version: v1.0
type: GraphSettings
attributes: {canvasWidth: '1089', id: GraphSettings, canvasHeight: '531'}
attributes: {canvasWidth: '1322', id: GraphSettings, canvasHeight: '638'}
2 changes: 1 addition & 1 deletion firmware/src/config/default/default.mhc/atecc608.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ children:
- type: TargetAttachment
attributes: {targetComponentID: sercom0, targetAttachmentID: SERCOM0_I2C}
- type: ElementPosition
attributes: {x: '162', y: '455', id: atecc608}
attributes: {x: '176', y: '553', id: atecc608}
2 changes: 1 addition & 1 deletion firmware/src/config/default/default.mhc/cryptoauthlib.yml
Original file line number Diff line number Diff line change
Expand Up @@ -588,4 +588,4 @@ children:
children:
- {type: Value, value: sercom0_i2c}
- type: ElementPosition
attributes: {x: '315', y: '480', id: cryptoauthlib}
attributes: {x: '324', y: '555', id: cryptoauthlib}
2 changes: 1 addition & 1 deletion firmware/src/config/default/default.mhc/drv_at25df.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,4 @@ children:
children:
- {type: Value, value: drv_memory_MEMORY_dependency}
- type: ElementPosition
attributes: {x: '163', y: '131', id: drv_at25df}
attributes: {x: '168', y: '132', id: drv_at25df}
2 changes: 1 addition & 1 deletion firmware/src/config/default/default.mhc/drv_i2c.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ children:
children:
- {type: Value, value: SERCOM0_I2C}
- type: ElementPosition
attributes: {x: '163', y: '274', id: drv_i2c}
attributes: {x: '174', y: '389', id: drv_i2c}
36 changes: 1 addition & 35 deletions firmware/src/config/default/default.mhc/drv_memory.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,6 @@ format_version: v1.0
type: GeneratorComponent
attributes: {id: drv_memory}
children:
- type: Symbols
children:
- type: Combo
attributes: {id: DRV_MEMORY_COMMON_MODE}
children:
- type: Values
children:
- type: Dynamic
attributes: {id: drv_memory, value: Asynchronous}
- type: Boolean
attributes: {id: DRV_MEMORY_COMMON_SYS_TIME_ENABLE}
children:
- type: Values
children:
- type: Dynamic
attributes: {id: drv_memory, value: 'false'}
- type: Instances
children:
- type: InstanceComponent
Expand Down Expand Up @@ -60,24 +44,6 @@ children:
children:
- type: Dynamic
attributes: {id: drv_memory_0, value: 'false'}
- type: Menu
attributes: {id: DRV_MEMORY_RTOS_MENU}
children:
- type: Attributes
children:
- type: Boolean
attributes: {id: visible}
children:
- {type: Value, value: 'false'}
- type: File
attributes: {id: DRV_MEMORY_SYS_RTOS_TASK}
children:
- type: Attributes
children:
- type: Boolean
attributes: {id: enabled}
children:
- {type: Value, value: 'false'}
- type: Attachments
children:
- type: DirectDependency
Expand All @@ -94,4 +60,4 @@ children:
children:
- {type: Value, value: memory}
- type: ElementPosition
attributes: {x: '324', y: '161', id: drv_memory}
attributes: {x: '321', y: '134', id: drv_memory}
2 changes: 1 addition & 1 deletion firmware/src/config/default/default.mhc/drv_usbfs_v1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ type: UniqueComponent
attributes: {id: drv_usbfs_v1}
children:
- type: ElementPosition
attributes: {x: '569', y: '415', id: drv_usbfs_v1}
attributes: {x: '819', y: '89', id: drv_usbfs_v1}
Loading

0 comments on commit ece90ba

Please sign in to comment.