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
The chip can remember state after a reset - the RAM isn't automatically cleared.
So you can store a magic signature in RAM somewhere. Or you can connect an EEPROM or F-RAM memory for telling current/next binary to run.
You can obviously not just reprogram the flash with new binaries. But you can store more than one application and have a boot loader decide which application to start.
So you would first have to learn how to implement a boot loader. Come back when you have managed that, and it will be meaningful to discuss the concept of selecting which application to start. A boot loader can even do a full fallback waiting for a new binary on a serial port or downloading an application from a SPI-connected flash memory. Lots can be done. But first you need a working concept with a boot loader and with applications linked for use at an address different from the address range where the boot loader is stored.
Note that you can't catch the reset - it really do force a reset of the processor. So you have to make your decission after the processor have restarted. So whatever you do, you can't have any for loop that alternates between two applications.
Hello,
Do you perhaps know how to change overwrite the date stamp of the bin file, My idea is to have two bin files on the flash memory and to change the date stamp of the first bin file so it is now older than the second and then force a reset on the micro control causing the second bin file to now be loaded into the flash memory because it has the newer time date stamp.
If you can please help me figure out how to overwrite the date stamp this would be really helpful.
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.
Do you perhaps know how to fix this code to make the rename in my software to start working
int rename(const char *old, const char *new) { return -1; }
I have been told something needs correcting or is wrong ?
Just ignore this guy, it's a joke.
this is not a joke, I am working with two boards one is the MCB1700 board the other is the MBED, that code I posted is from the Mbed library but they are only a very small ground and never very helpful or clever.
this is not a joke
well, the above post is
"Do you perhaps know how to fix this code to make the rename in my software to start working
I have been told something needs correcting or is wrong ?"
well Peter Jones is a joke and so is his business and all the employers he hires or is it theo?? which one.. they both have shares in your company right
What "your business"? This is a forum for end users. We who write here are Keil customers - not Keil employees.
By the way - post after post after post and you finally managed to mention mbed. Shouldn't mbed have been the first thing mentioned in your original post? How would anyone on this forum be able to answer any single question about mbed if you don't even tell that you do work with an mbed product?
Who the hell is Peter Jones? Why should we care? WTF!?
see you on mars later.
see you on mars later won't be there women are from Venus :)
Erik
Well I have so many stars to choose from I am spoiled for choice, I heard lyran's women think your all annoying and never very professional in the forum what so ever:) like kindergarten children.
I found code anyway
#include "mbed.h" #include "rename.h" #include "ConfigFile.h" LocalFileSystem local("local"); // Create the local filesystem under the name "local" ConfigFile cfg; int lastStat; int main(void) { /* * Read a configuration file from a mbed. */ cfg.read("/local/lastStat.cfg"); * Read a configuration value. */ if (cfg.getValue(key1, &value[0], sizeof(value))) { if (lastStat.cfg == 1) { cfg.write("/local/lastStat.cfg", "0"); } else { cfg.write("/local/lastStat.cfg", "1"); } if (lastStat.cfg == 1) { file_rename("/local/Test.bin", "/local/new_name.old");} if (lastStat.cfg == 0) { file_rename("/local/new_name.old", "/local/Test.bin");} // int main() { //FILE *fp = fopen("/local/Test.txt", "w"); // Open "out.txt" on the local file system for writing // fprintf(fp, "Hello World!"); //fclose(fp); //file_rename("/local/Test.bin", "/local/new_name.old"); }
and you all lied about the time stamp as well, http://www.keil.com/support/man/docs/rlarm/rlarm_lib_rl_time.htm
FRESULT set_timestamp ( char *obj, <span>/* Pointer to the file name */</span> int year, int month, int mday, int hour, int min, int sec ) { FILINFO fno; fno.fdate = (WORD)(((year - 1980) * 512U) | month * 32U | mday); fno.ftime = (WORD)(hour * 2048U | min * 32U | sec / 2U); return f_utime(obj, &fno);
Maybe you should all talk in code instead of the stupid comments you always make.
I found code anyway so that was what it was about, you wanted us to do it for you.
Congratulations sweetheart, you were given a real pearl. Enjoy from it while you can.
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 many times did we ask you to supply specific information about what software you did run, since the processor itself don't have any file system?
would any of you know how to detect when the mbed's hardware reset button has been pushed, so I can then use that to trigger a copy rename and delete of my bin file.
I have the code for a software reset and plan to use an external push button to that if I can not figure out how to do above.
I have a blue reset button on my MCB1700 as well I don't mind using that one if you prefer
> NVIC_SystemReset() #define NVIC_SYSRESETREQ 2 /*!< System Reset Request */ #define NVIC_AIRCR_VECTKEY (0x5FA << 16) /*!< AIRCR Key for write access */ static __INLINE void NVIC_SystemReset(void) { SCB->AIRCR = (NVIC_AIRCR_VECTKEY | (1<<NVIC_SYSRESETREQ)); /* Keep priority group unchanged */ asm("DSB"); while(1); /* wait until reset */ } <
> /** * @brief Initiate a system reset request. * * Initiate a system reset request to reset the MCU */ static __INLINE void NVIC_SystemReset(void) { SCB->AIRCR = ((0x5FA << SCB_AIRCR_VECTKEY_Pos) | (SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) | SCB_AIRCR_SYSRESETREQ_Msk); /* Keep priority group unchanged */ __DSB(); /* Ensure completion of memory access */ while(1); /* wait until reset */ } /*@}*/ /* end of group CMSIS_CM3_Core_FunctionInterface */ <
View all questions in Keil forum