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

firmware/sys/storage: Re-modification of storage module #359

Merged
merged 1 commit into from
Oct 10, 2022

Conversation

CW-75
Copy link
Collaborator

@CW-75 CW-75 commented Sep 29, 2022

Contribution description

Read and write dynamically, writing in blocks, to write and read data from mtd_storage. This will remove the old model of storage using mtd_flashpages. Here is presented an distribution using mtd_addresses , to knows where is the MTD_START_ADDR you should know the size of allowed flashpages to save data as an Non volatile memory or EEPROM. The MTD_LAST_ADDR refers to the address in the LAST_AVAILABLE_PAGEto write and read data. The addt parameter allows move dynamically in the mtd_storage. Wherever address between the MTD_START_ADDR and MTD_LAST_ADDR will be available to write and read data. The save and write data is protected to overwrite data a specific positioned data, This won´t erase the previous data to that position. So it's necessary clear or remove all flash mtd_data saved.

Testing procedure

First activate DEBUG in test/storage/main.c

make -C tests/storage flash term

Expected Output

main(): This is RIOT! (Version: 2022.07-devel-1445-g0b5f27-HEAD)
..Empty_register

Empty_register
The index already exist, can´t be updated, file: /home/eduardo-az/github-forks/m4a-firmware/firmware/sys/storage/storage.c, line 182, function: mtd_save_reg
Empty_register
Empty_register
Available index: 0x8066E00
Available index: 0x8066E20
Available index: 0x8066E40
Available index: 0x8066E60
Number of available registers: 4

1C 00 4B 45 59 30 00 4B 45 59 31 00 4B 45 59 32 
00 4B 45 59 33 00 53 74 72 69 6E 00 00 70 06 08 
14 00 4B 45 59 31 00 4B 45 59 32 00 4B 45 59 33 
00 53 74 72 69 6E 67 23 31 20 6C 00 1C 70 06 08 
01 00 4B 45 59 32 00 4B 45 59 33 00 53 74 72 69 
6E 67 23 31 20 6C 6F 61 64 65 64 00 30 70 06 08 
04 00 4B 45 59 33 00 53 74 72 69 6E 67 23 31 20 
6C 6F 61 64 65 64 3A 20 25 73 0A 00 31 70 06 08 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
...

.Reading content of an register
Reading content of an register
Reading content of an register
Reading content of an register
String#1 loaded: Everyone in the mesh!!!
String#2 loaded: Contributor: CW
Uint32_t loaded: 155556
Uint8_t loaded: 24
.
Saving data:
.

Loading data:
Load successfully
....00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
...
OK (9 tests)

Issues/PRs references

@CW-75
Copy link
Collaborator Author

CW-75 commented Oct 3, 2022

Also if you wish to see more detailed, enable the debug mode in firmware/sys/storage/storage.c

@CW-75 CW-75 force-pushed the feature/storage_data branch from 29fb731 to 5f106aa Compare October 8, 2022 01:18
@CW-75 CW-75 changed the title WIP: storage: data to network module firmware/sys/storage: Re-modification of storage module Oct 10, 2022
Copy link
Contributor

@luisan00 luisan00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice job bro! ahead!

@CW-75 CW-75 merged commit 32444c7 into Mesh4all:main Oct 10, 2022
@CW-75 CW-75 deleted the feature/storage_data branch October 10, 2022 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants