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

Hardware reset

lpc1768 board or the MCB1700

does anybody know how to switch bins files using the hardware reset route, so when I press the reset button it will switch bins.

I know for software it could be something like this perharps

<

>
int main (void)
{
for (;;)
If

extern "C" void lpc1768_reset();

flash.write = binfile1

else

flash.write = binfile2

endif


}

<

>

thanks,

thomas

Parents
  • the magic chip I have is set up to load the .bin file with the newest date into the flash memory so if I have two bin files, one 1997 the other 2012 the 2012 will get loaded into flash, but if I can change the 1997 to say 2013 then that .bin will get loaded into flash.

    If I can add something in my code to change the date stamp and then a cfg file to handle the switching of the .bin

    I am student with no money so the boot loader method is not a option at the moment. Is it possible to rename the files somehow so the extension is not .bin to say .old then perhaps the second .bin file will get loader into flash.

    if (lastStatus == 1) {
    write 0 into a new lastStatus.cfg
    } else {
    write 1 into a new lastStatus.cfg
    }
    
    if (laststatus == 1) {
    rename binfile1 to .old;
    rename binfile2 to .bin;
    }
    
    if (laststatus == 0) {
    rename binfile1 to .bin;
    rename binfile2 to .old;
    }
    

Reply
  • the magic chip I have is set up to load the .bin file with the newest date into the flash memory so if I have two bin files, one 1997 the other 2012 the 2012 will get loaded into flash, but if I can change the 1997 to say 2013 then that .bin will get loaded into flash.

    If I can add something in my code to change the date stamp and then a cfg file to handle the switching of the .bin

    I am student with no money so the boot loader method is not a option at the moment. Is it possible to rename the files somehow so the extension is not .bin to say .old then perhaps the second .bin file will get loader into flash.

    if (lastStatus == 1) {
    write 0 into a new lastStatus.cfg
    } else {
    write 1 into a new lastStatus.cfg
    }
    
    if (laststatus == 1) {
    rename binfile1 to .old;
    rename binfile2 to .bin;
    }
    
    if (laststatus == 0) {
    rename binfile1 to .bin;
    rename binfile2 to .old;
    }
    

Children
  • A boot loader is not a monetary cost - it's an investment in time.

    But then again - you are obviously not telling us the complete story here. Without a boot loader - what software is looking at time stamps for programming your flash? And exactly where are these binaries stored since you need to reprogram them into flash to be able to run them?

  • It is a magic chip that looks for the time stamps which I don't have access at the moment to the code, they are store on the flash memory but not programed into it yet.

    If my code is like this for rename

    
    62
    63          /* Function rename
    64           *  Rename a file in the filesystem.
    65           *
    66           * Variables
    67           *  oldname - the name of the file to rename.
    68           *  newname - the name to rename it to.
    69           *  returns - 0 on success, -1 on failure
    virtual int rename(const char *oldname, const char *newname) { return -1; };
    

    How do I rename files in ARM style

    I have tried

    rename *out.txt AS *yes.txt;

    but it does not work

  • There are no "ARM style" file rename.

    And what is "magic" here?

    If someone have given you a board with a standard LPC17xx processor but with a custom software that have some magic logic in it, you will obviously have to ask that person what magic there is - the documentation for the preprogrammed software.

    I do know how to use the software Flash Magic to download software to a LPC17xx chip. But that doesn't involve playing with any time stamps on any binary files stored in any flash somewhere.

  • Is it possible for me to add my own code into lpc17xx

    how would I add stat -c to read the time stamp and touch -d to change the time stamp much like it is in linux does any arm exist??

    virtual int stat(const char *-c) { return -1; };
    virtual int touch(const char *-d) { return -1; };

    #!/bin/bash
    #
    BASE_OLD=/mnt/old-raid
    BASE_NEW=/mnt/new-raid
    
    cd $BASE_OLD
    find . -type f |
    while read fname
    do
    $BASE_NEW/${fname}
    
    TS=$(stat -c '%Y' "${BASE_OLD}/${fname}")
    
    
    TIMESTAMP=$(date -d @${TS} +'%d %b %Y %R')
    
    touch -d "${TIMESTAMP}" "${BASE_NEW}/${fname}"
    
    echo "${BASE_NEW}/${fname}"
    
    done
    

  • Does anybody here understand what the OP wants from our lives?
    Brother, it is not a PC your working with, OK?

  • Why don't you just tell me the ARM code for getting the time stamp and changing it then, because I know it exist.

  • The "ARM code" will require you to address the chip's RTC (I think it has one) or a network source, hardware timer etc.

  • And I can use that to change the .bin time stamp or do I need to change the lpc17xx time stamp so it is newer date than the .bin . if you understand what I mean instead of changing the .bin time stamp are you saying to just change the lpc17xx chips time stamp.

  • If your program contains the ANSI C macros __TIME__ and/or __DATA__ you can expect a "time stamp" in your .bin files regardless of LPC1768 RTC settings.
    You really need to first _understand_ what you are doing (and talking about) and to my understanding you don't. Merging bin files? Are you sure that's a good idea?

  • I am student with no money so the boot loader method is not a option at the moment.

    How exactly is a bootloader related to you not having any money?

  • A .bin file contains no "time stamp" of any kind unless __TIME__ and/or __DATE__ are compiled with the sources.

  • I am I am trying to time travel ok:)

    the magic chip I have yes do you understand loads the bin file with the future time into the flash memory you understand I have second bin that is the past ok :)

    I want to change the past bin so it is the future bin ok

    so for me to do this I have to change the time stamp or rename the file ok.

    Do you understand what I am I am trying to do I am

  • DO you really think that I did not already know this, for something that should have taken 3 mins of time today has taken how long.

  • Then use a hex editor to go back to the future...!

  • But no standard LPC17xx processor have a file system. It's just a dumb processor.

    And the boot loader shipped inside the LPC17xx do not have any functionality to look for any files anywhere to program into the flash.

    So all your references up until now aren't telling us any single thing about what software you are trying to fight with.

    A standard MCB1700 board do not contain any file system unless someone have added such software to the board. And it is then that specific implementation that controls how to access files. How to see if there are date stamps associated with the files. And it is then that specific software that may potentially copy files from an external flash memory into the internal flash of the LPC17xx processor. Or if you have a LPC17xx processor that do support running from external memory.

    But whatever information you do not supply to us, can not be understood by us. We can't guess. So we can't help.

    The one who supplied you with a preprogrammed board should know the answers to your questions.