Oh, that's great. That should definitely make the interface better.

But nevertheless, I tried to "ignore" the terms, and still I can't make any
sense of it.

This is what I try to do (which works fine on an STM32F4):

int write_data(intptr_t addr, BootData_t * data){
        if (memcmp((BootData_t*)addr, data, sizeof(BootData_t)) == 0)
                return 0;

        if (up_progmem_eraseblock(up_progmem_getpage(addr)) < 0)
                return -EIO;

        return up_progmem_write(addr, data, sizeof(BootData_t));}


I see that up_progmem_getpage() makes an unreasonable calculation.
It calculates the "page" as if it is 256 bytes, while in fact LPC1769 has
4k and 32k sectors...



Στις Παρ, 2 Ιουλ 2021 στις 1:39 μ.μ., ο/η Xiang Xiao <
xiaoxiang781...@gmail.com> έγραψε:

> Here has some discussion about the naming:
> https://github.com/apache/incubator-nuttx/pull/3834
>
> On Fri, Jul 2, 2021 at 6:28 PM Fotis Panagiotopoulos <f.j.pa...@gmail.com>
> wrote:
>
> > Hello,
> >
> > I am porting an old application to NuttX.
> > This is running on a hardware board that uses the NXP LPC1769 MCU.
> > I am in need of the up_progmem interface.
> >
> > Unfortunately, I see that this driver is broken. It is not working,
> always
> > returning an error.
> > I checked its internals, but it is quite a mess. It makes wrong
> > calculations on the sector sizes, it confuses the terms "page" and
> "sector"
> > etc.
> > I see that it makes some calculations on the addresses, that to my
> > knowledge do not reflect the hardware in any way.
> >
> > Is it actually that broken, or am I using it so incorrectly?
> > Has anyone used it before successfully?
> >
> > I would appreciate a MWE of this driver. Or someone to confirm that it is
> > not working before I start to rewrite it.
> >
>

Reply via email to