This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

DS5250 Flash access?

I'm currently working with the DS5250 evaluation kit.
I tried to write a small application to permanently store data in the flash chip, but I have trouble understanding how this is mapped.

I'm currently reading/writing to flash like this:

FLASH_READ:
//reads the content of the flash memory and puts it in CHAR_VALUE
        MOV DPTR, #flashcharc
        ORL FLMC, #010h ; enable flash access (sets FLMC.4 (FLCM) to 1)
        MOVX A, @DPTR
        ANL FLMC, #0EFh ; disable flash access (clears FLMC.4 (FLCM) to 0)
        MOV CHAR_VALUE, A

        RET

FLASH_WRITE:
        //writes CHAR_VALUE to the flash memory

        MOV DPTR, #flashcharc
        MOV A, CHAR_VALUE
        ORL FLMC, #010h ; enable flash access (sets FLMC.4 (FLCM) to 1)
        MOVX @DPTR, A
        ANL FLMC, #0EFh ; disable flash access (clears FLMC.4 (FLCM) to 0)

        RET


I'm defining the variable #flashcharc like this:

char far flashcharc _at_ 0x100001;

I'm placing it there because I understand that flash can be accessed from address 0x100000.
Of course it doesn't work at all. Can someone point me what I'm doing wrong?
I'm using a ROM size of "Contiguous Mode: 16MB program" and "Large: variables in XDATA" memory model.

I'd really appreciate a nudge in the right direction.

Parents
  • I compiles fine.
    If I don't use 'far' the compiler complains with

    MAIN-HELP.C(13): error C274: 'flashcharc': absolute specifier illegal
    

    Unfortunately since the DS5250 is a secure microprocessor the info about it is very lacking.
    Being able to see some example code would help me a lot, but with all those NDAs I guess that's not an option.
    I email Maxim yesterday about the problem, but I'm still waiting for the reply.
    I hope they can help me see the light.

Reply
  • I compiles fine.
    If I don't use 'far' the compiler complains with

    MAIN-HELP.C(13): error C274: 'flashcharc': absolute specifier illegal
    

    Unfortunately since the DS5250 is a secure microprocessor the info about it is very lacking.
    Being able to see some example code would help me a lot, but with all those NDAs I guess that's not an option.
    I email Maxim yesterday about the problem, but I'm still waiting for the reply.
    I hope they can help me see the light.

Children
  • "since the DS5250 is a secure microprocessor the info about it is very lacking"

    I don't buy that. Security doesn't come from lack of information. The question you should ask is: Do they keep down on the information because they know about any lack of security?

  • Could anyone post an example in a non-secure microprocessor based on the 8051?
    Maybe from there I could find out what the problem is.

    All I want to do is write some data on the flash memory.
    BTW, if it's any help, the flash I'm using is a AM29F080B.

    Thanks in advance.

  • "Could anyone post an example in a non-secure microprocessor based on the 8051?"

    Have you actually looked at the examples that are installed with your Keil tools?

    They are also available at http://www.keil.com/download/

    And don't forget the Application Notes: http://www.keil.com/appnotes/

    "All I want to do is write some data on the flash memory."

    Begin with the basics - forget about 'far', and just try writing to the part of your flash that appears in the 8051's standard 64K XDATA address space.

    Once you have that working, then you can adapt it to work beyond the 64K limit...

    "the flash I'm using is a AM29F080B."

    Go to the manufacturer's website - they will almost certainly have example code for writing to their devices...