Take a look at using a combination of; LoLo boot time script, LoLo environment variables, and LoLo shell conditional execution.
For example, you can use LoLo's
x command to read a piece of non-volatile memory (SRAM, flash, etc.) or perhaps a GPIO connected to a button.
The
x command saves what it read into the
@ environment variable. You can then use LoLo's logical and conditional operators to do what you want.
For example:
x 0xaabbccdd ; read some address
MY_VALUE = $@ ; save the value read into a new variable (@ will be overwritten by another command eventually)
if ( $MY_VALUE & 0x01 ) ; see if some bit is set
load bin my_ce_image
else
load elf my_diagnostic_application
endif
exec
Of course, where and what you read, test for, and load is completely up to you. But this might give you some ideas.
If you try doing raw writes and reads using NOR flash, you'll need to make sure you don't conflict with any existing file system. So I think the best application of the above method is either a GPIO, SRAM, or an internal scratch register - something that doesn't require the overhead of flash.
Another option would be to use LoLo's YAFFS file system and a simple marker file. By marker file I mean a file that doesn't actually contain any information, rather it's mere existence indicates that some action should or should not be taken. Think of it like a UNIX lock file. In that case, you can leave a marker file in the YAFFS partition when your OS is running. When LoLo boots, a boot time script can mount the YAFFS partition and then try and
cat the file. If the
cat command succeeds, the
? environment variable will be
0. If the
cat command fails, then the
? variable will contain the error code.
Quickly:
add-yaffs boot nor 0x... 0x...
mount yaffs /boot
cat /boot/my_marker_file
if $?
echo 'marker file not there - load something'
else
echo 'marker file there - load something else'
endif
Read the LogicLoader's User Manual and Command Guide for complete details.
Regards,
--mikee