Skip to content

sys/eepreg: use MTD#22158

Open
fabian18 wants to merge 18 commits intoRIOT-OS:masterfrom
fabian18:pr/eepreg_mtd
Open

sys/eepreg: use MTD#22158
fabian18 wants to merge 18 commits intoRIOT-OS:masterfrom
fabian18:pr/eepreg_mtd

Conversation

@fabian18
Copy link
Copy Markdown
Contributor

Contribution description

Add an MTD to the EEPROM registry API, so that other MTD (EEPROMS) can also be used.

  • Extend EEPROM registry API
  • Create internal EEPROM MTD
  • Add mtd_eeprom to boards that support periph/eeprom
  • Adapt tests

Testing procedure

USEMODULE+=at24mac CFLAGS+=-DTEST_EEPREG_MTD="mtd_dev_get\(1\)" DEVELHELP=1 VERBOSE_ASSERT=1 make -C tests/sys/eepreg/ BOARD=same54-xpro flash term

2026-03-30 20:42:36,101 # START
2026-03-30 20:42:36,107 # main(): This is RIOT! (Version: 2026.04-devel-325-ge13ff-pr/eepreg_mtd)
2026-03-30 20:42:36,110 # EEPROM registry (eepreg) test routine
2026-03-30 20:42:36,121 # Testing new registry creation: reset check [SUCCESS]
2026-03-30 20:42:36,162 # Testing writing and reading entries: add write add read [SUCCESS]
2026-03-30 20:42:36,171 # Testing detection of conflicting size: add [SUCCESS]
2026-03-30 20:42:36,184 # Testing calculation of lengths: len len [SUCCESS]
2026-03-30 20:42:36,347 # Testing of successful data move after rm: rm read data [SUCCESS]
2026-03-30 20:42:36,373 # Testing of free space change after write: free add free [SUCCESS]
2026-03-30 20:42:36,384 # Testing of iteration over registry: iter bar foo [SUCCESS]
2026-03-30 20:42:36,385 # Tests complete!
2026-03-30 20:42:36,392 # { "threads": [{ "name": "main", "stack_size": 1536, "stack_used": 488 }]}

Issues/PRs references

@github-actions github-actions bot added Platform: native Platform: This PR/issue effects the native platform Area: tests Area: tests and testing framework Platform: AVR Platform: This PR/issue effects AVR-based platforms Area: drivers Area: Device drivers Area: boards Area: Board ports Area: cpu Area: CPU/MCU ports Area: sys Area: System labels Mar 30, 2026
@crasbe crasbe added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Mar 30, 2026
Copy link
Copy Markdown
Contributor

@crasbe crasbe left a comment

Choose a reason for hiding this comment

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

The static test has some comments too and why is mtd_eeprom.h sometimes conditionally and sometimes unconditionally included? 🤔

#if MODULE_MTD_EEPROM
static mtd_eeprom_t eeprom_mtd = MTD_EEPROM_INIT_VAL;
MTD_XFA_ADD(eeprom_mtd, 0);
#endif /* MODULE_MTD_EEPROM */
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The closing bracket for Doxygen is misisng.

#endif

#if MODULE_MTD_EEPROM
#include "mtd_eeprom.h"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
#include "mtd_eeprom.h"
# include "mtd_eeprom.h"

#if MODULE_MTD_EEPROM
static mtd_eeprom_t eeprom_mtd = MTD_EEPROM_INIT_VAL;
MTD_XFA_ADD(eeprom_mtd, 0);
#endif /* MODULE_MTD_EEPROM */
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Closing group missing too.

* @{
*
* @file
* @brief Definitions for all atmega boards.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copy&Paste error.

#if MODULE_MTD_EEPROM
static mtd_eeprom_t eeprom_mtd = MTD_EEPROM_INIT_VAL;
MTD_XFA_ADD(eeprom_mtd, 0);
#endif /* MODULE_MTD_EEPROM */
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Closing bracket missing.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

in this file the Doxygen closing bracket is present

#if MODULE_MTD_EEPROM
static mtd_eeprom_t eeprom_mtd = MTD_EEPROM_INIT_VAL;
MTD_XFA_ADD(eeprom_mtd, 0);
#endif /* MODULE_MTD_EEPROM */
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Closing bracket missing.

#if MODULE_MTD_EEPROM
static mtd_eeprom_t eeprom_mtd = MTD_EEPROM_INIT_VAL;
MTD_XFA_ADD(eeprom_mtd, 0);
#endif /* MODULE_MTD_EEPROM */
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Closing bracket missing.


/**
* @{
*
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Incomplete header.

Comment on lines +3 to +7
# Copyright (C) 2026 ML!PA Consulting GmbH
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please migrate this to SPDX.


#define DAT_START (EEPROM_SIZE - EEPROM_RESERV_CPU_HI \
#ifndef TEST_EEPREG_MTD
#define TEST_EEPREG_MTD MTD_0
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
#define TEST_EEPREG_MTD MTD_0
# define TEST_EEPREG_MTD MTD_0

@riot-ci
Copy link
Copy Markdown

riot-ci commented Mar 30, 2026

Murdock results

FAILED

1bdc4f7 fixup! boards: add mtd_eeprom for nucleo boards

Success Failures Total Runtime
10545 0 10989 12m:58s

Artifacts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: boards Area: Board ports Area: cpu Area: CPU/MCU ports Area: drivers Area: Device drivers Area: sys Area: System Area: tests Area: tests and testing framework CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Platform: AVR Platform: This PR/issue effects AVR-based platforms Platform: native Platform: This PR/issue effects the native platform

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants