External FRAM over SPI as memory area

I am working with already existing code, so please bear with the constraints given to me.

I am co-developing a system that sends sensor data periodically to a gateway over bluetooth. The sensor is battery-driven so it can gather data even when it is not connected to a gateway or in transit. For this it is buffering the data in the RAM and waits until a connection to a gateway is made again.

As the amount of data may exceed the RAM of the nrf52833, it was decided to use an external RAM, an Infineon CY15B104Q. I was provided a driver and managed to configure the SPI side of the FRAM like this (the EEPROM was already configured):

&spi1 {
	compatible = "nordic,nrf-spi";
	status = "okay";
	pinctrl-0 = <&spi1_default>;
	pinctrl-1 = <&spi1_sleep>;
	pinctrl-names = "default", "sleep";
	cs-gpios = <&gpio0 11 GPIO_ACTIVE_LOW>, <&gpio0 12 GPIO_ACTIVE_LOW>; //SIO_11 MCU_0403_A - SPI_CS1
	eeprom_m95040:eeprom_m95040@0 {
		// M95040 is compatible with atmel at25 eeprom driver
		compatible = "atmel,at25";
		reg = <0>;
		size = <DT_SIZE_K(512)>;
		pagesize = <512>;
		address-width = <24>;
		spi-max-frequency = <8000000>;
		timeout = <5>;
	};
	cy15b104:cy15b104@1 {
		compatible = "infineon,cy15b104";
		reg = < 1 >;
		size =<DT_SIZE_M(4)>;
		address-width = <24>;
		spi-max-frequency = <50000000>;
		timeout = <5>;
	};

The driver supports direct writing to an address and an offset, but the exisiting class for the sensor samples uses library functions from <etl/circular_buffer.h> like pop and push for a ring buffer.

My aim is to export the whole ring buffer to the external FRAM and manage all buffer operations over SPI. But without implementing my own ring buffer functions it would seem I would have to 'emulate' the external FRAM as a memory area. Is there any possibility to implement this as a kind of override? Is it possible to configure the FRAM as a memory extension with its own virtual address range?

The size of the sensor buffer is generally not known, and there are two sensors with their own differently sized buffers, so the buffer is part of a class template.

Any support or ressources for this would be greatly appreciated.

Greetings,
Rico

Related