View Full Version : Writing to flash ic from firmware issue.
spaceimpact33
22-10-2005, 10:44 AM
Hi,
I have been trying to impelement the Flash File System By g3gg0 in mados into nokix. I have implemented all the code and converted all the functions over but the problem is if i try and enable flash_vpp using io it seems to be turning the LCD Led's off, so i think there is a problem with my io port definitions.
#define IO_UIF_CTRL2 0x32
#define IO_UIF_CTRL3 0x33
#define UIF_CTRL3_VPP 0x01
#define UIF_CTRL2_VPP1 0x01
#define UIF_CTRL2_VPP2 0x20
#define UIF_CTRL3_VPP 0x01
void
flash_vpp ( unsigned int state )
{
if ( state )
io_set_bit ( 0x00020000 + IO_UIF_CTRL3, UIF_CTRL3_VPP );
//io_set_bit ( 0x00020000 + IO_UIF_CTRL2, UIF_CTRL2_VPP1 | UIF_CTRL2_VPP2 );
else
io_clr_bit ( 0x00020000 + IO_UIF_CTRL3, UIF_CTRL3_VPP );
//io_clr_bit ( 0x00020000 + IO_UIF_CTRL2, UIF_CTRL2_VPP1 | UIF_CTRL2_VPP2 );
return;
}
The code i use for io_set_bit & io_clr_bit works fine but this jt doesn't want to work :(.
any help would be great :D
Regards Daniel.
joci2000
22-10-2005, 01:10 PM
U mean keyboard led? because the keypad leds are on the same byte with vpp flash.
try this UIF_CTRL3_VPP 0x11 this will activate the 11 bit which are the flash vpp and keypad led. originally the value of this is 10 which mean the leds on.
and for deactivating in my opinion would be better to use io_set_bit also but with bit 10.
i hope this will solve your problem.
you can find more info about io ranges here (http://cc19990-a.groni1.gr.home.nl:8000/nokia/sub_100hardware/sub_331x/sub_iomap)
spaceimpact33
24-10-2005, 09:12 AM
@joci2000
Thanks for the reply mate :D, I still have not had any success with it dose any one know if there are built in functions in nokia's firmware for flashing the flash ic? eg EEPROM routines?
cheers
NokDoc
24-10-2005, 11:53 AM
[QUOTE=spaceimpact33..dose any one know if there are built in functions in nokia's firmware for flashing the flash ic?...[/QUOTE]
Hi Mr. S,
I think at every phone boot Nokia does flashing too, from within MCU functions.
Code for this is transfered into ram 1st while initialising, since like on a pc, OS can't write on top of it's own OS.
I dono precise how it works, although the last some 8 functions in Ur mcu, after the datas part has these desired code U were looking for.
For more info, U know howto contact me...
(eg, for WinArm code dump, since U will experience U can't watch then directly from within mcu.
NokDoc
spaceimpact33
30-10-2005, 07:04 AM
@all
i managed to get flashing working correctly. for thoes interested the code to en/disable flash ic VPP is as follows:
void enable_flash_vpp()
{
disable_irq ( );
*(UBYTE *)0x20033 = *(UBYTE *)0x20033 | 0x1;
enable_irq ( );
delay(0x14);
}
void disable_flash_vpp()
{
disable_irq ( );
*(UBYTE *)0x20033 = *(UBYTE *)0x20033 & 0xfe;
enable_irq ( );
}
Thanks all for the reply's.
regards SI33.
mestrini
30-10-2005, 12:35 PM
so this means it will be possible to change PPM strings while operating the phone? :-o cool :D
spaceimpact33
30-10-2005, 04:08 PM
yeah i guess it could be used for on-the-go modding haha, my aim of this is to get a working, yet simple file system where we can store more sms's than the sad 30 on the simcard. So far I have the file system working well it is able to write and read files but after a file has been writen the phone functions fine with no hanging and then randomly will reset about 10 seconds later and im not sure whats causeing it. Im thinking something along the lines of conflictions with eeprom write routines.
Regards si33.
mestrini
30-10-2005, 04:23 PM
yeah i guess it could be used for on-the-go modding haha, my aim of this is to get a working, yet simple file system where we can store more sms's than the sad 30 on the simcard. So far I have the file system working well it is able to write and read files but after a file has been writen the phone functions fine with no hanging and then randomly will reset about 10 seconds later and im not sure whats causeing it. Im thinking something along the lines of conflictions with eeprom write routines.
Regards si33.
maybe because of checksums issues? ;) Don't forget it's necessary to update them or phone will think firmware is corrupted :-o
spaceimpact33
30-10-2005, 04:44 PM
hmmm could well e, but all checksums are dead...
mestrini
30-10-2005, 04:52 PM
hmmm could well e, but all checksums are dead...
HEHE :lol: forgot about that
there goes my theory, unless there's some other checks working ???
spaceimpact33
30-10-2005, 05:02 PM
strange... it now no longer resets the phone yet the code is exacly the same. I have managed to beable to format the file system and write 8 files in a sequence with no issues at all. :-D
joci2000
01-11-2005, 11:18 AM
with this solution it is possible to make a more effective firmware and phone protector :D
think it a simple program ask a number or any text which is defined in a Nokix script and if it isn't the same the program delete the all firmware and the phone become dead :D
mestrini
01-11-2005, 12:25 PM
with this solution it is possible to make a more effective firmware and phone protector :D
think it a simple program ask a number or any text which is defined in a Nokix script and if it isn't the same the program delete the all firmware and the phone become dead :D
that's what happens with MADos erase flash test :D
i think a better solution was to make a routine to enable the FAID check again but with wrong values. this way the phone would reboot every 30 secs :lol:
spaceimpact33
11-11-2005, 04:30 PM
ok, I have the file system working 100% :D Write & Read routines work perfect!
Now i need some help with sms routines, i need to read sms's
from the sim so i can save them to the file system. I see Yak has
defined sms relates UI Messages in nokix but they dont seem to act
in the way there described.
/* sms */
#define MSG_SMS_RECEIVED (0x1463) /* arg0 = pointer to sms */
#define MSG_SMS_STORED (0xc3a) /* arg0 = pointer to sms (includes storing location) */
#define MSG_SMS_SEND (0x1462) /* arg0 = 0x65; arg1 = 0; arg2 = pointer to sms */
#define MSG_SMS_WRITE (0x145b) /* arg0 = 0x65; arg1 = pointer to sms */
#define MSG_SMS_DELETE (0x145d) /* arg0 = 0x65; arg1 = mem type; arg2 = location */
I am catching these messages in the message process...
Any help would be great :D
Regards Daniel.
danwood76
18-11-2005, 04:15 PM
Nice work spacey!
Sounds like your doing well with this little project :-D
regards,
Danny ;)
spaceimpact33
18-11-2005, 07:03 PM
@danwood76
Yes it seems to be coming along well :)
@all
So far in my project I have managed to complete:
- 65kb allocated to flash as file system storage (plenty of sms's could be stored here).
- File reading and writing with out interrupting normal phone usage.
- File system cleaning and de-fragmenting(when a files deleted it is only marked as deleted not actually removed from the system so de-fragmenting removes it completely and frees up some room.).
- Received sms saving (all text, timestamp and sender's number saved in one file).
- Listing of files in file system.
- Listing of mail files.
- Conversion of a phone number to Contact name.
- New Inbox views with sms previews time and sender displayed in list.
There is still much more to be done so I make no promises about this being released very soon. But I will keep you all updated.
Regards,
Spaceimpact33
wooow :eek: niiice :D I'm waiting for Beta Flash :P
hmmm 65kb memory is about 400 sms... have i right ? :)
g3gg0
13-12-2005, 06:56 PM
erhm daniel......
very nice idea :)
i wanted to do the same somewhen ...
thought its the best to inject some code into the SIM handling routines.
for example capturing the commands sent to the SIM, that request the
number of SMS slots and the SMS's and interface it to your own code.
shouldnt be that complicated :)
i dont think its (easily) possible vie the MSG system, but i didnt do anything
with that one - maybe i dont know how powerful that is ;)
btw:
a little "trick" when changing a 64k block...
if you do it like that:
malloc 64k - read the old block - change the data in ram - clear the old flash block - write the changed block to flash again
you could do it _better_ and save 64k malloc and increase the lifetime of flash
i think my _idea_ for the MADos Flash File System was like that: (didnt implemt this anyway)
u use a second or even third spare block,
the first word is the "active" flag
stage 0 -> 0xFFFF inactive / not formatted (empty, cleared block)
stage 1 -> 0xAAFF inactive / available (maybe header etc already written, ready for data)
stage 2 -> 0xAA55 used / active (header and ACTUAL valid data)
stage 3 -> 0xAA00 used / old data (has to be formatted -> stage 1)
if you want to use more blocks, than just one 64k, the 2nd word will be the
block number.
e.g. with 8 flashblocks
FlashBlock 1: AA550001... 1st block with data
FlashBlock 2: AA550002... 2nd block with data
FlashBlock 3: AA000003... OLD 3rd block with data
FlashBlock 4: AA550004... 4th block with data
FlashBlock 5: AA550003... 3rd block with data
FlashBlock 6: AAFFFFFF... ready-to-use formatted block
FlashBlock 7: AAFFFFFF... ready-to-use formatted block
FlashBlock 8: FFFFFFFF... unformatted empty block
the FlashBlocks 1, 2, 5 and 4 are Filesystem blocks 1-4
FlashBlock 3 contains old data and has to be 1st erased and 2nd formatted somewhen (takes little time) -> todo in idle mode
FlashBlock 6 and 7 are ready to get written with the next changed data
FlashBlock 8 is completely FF'ed and may be formatted when there is need (less than 2 empty stage-1 0xAAFF blocks)
this is meant just as some help if you want to make it keeping more SMS
or image messages
or maybe there is need for a filesystem in flash with nokix? ;)
greeetz, g3gg0
spaceimpact33
15-12-2005, 03:33 PM
@g3ggo
Thanks for ur ideas, currently im reserving two 64kb blocks 1 for use as a very simple garbage collection system as im not to sure about malloc'ing 64kb, does the nokia os allow for this much ram to be allocated? as for the saving of sms's i have managed to create several hooks in the messaging system to save the sms's as plain text or unicode (if needed) with a few flags and other feilds for data such as time, read status of the sms and the sender's phone number. it all seems to be running quite smoothly but i just need to stop the sms's from being saved to the simcard now and add support for extended length (multi part) sms's.
@all:
This project/script will not be released untill i get my hands on the new NokiX SDK V2 as the file system will be added as a nokix sub system so other script writers have access to file read and write routines for there own scripts.
Thank you for your interest.:D
Si33
Daryl Saludares
16-12-2005, 02:29 AM
it is a great script i know, and anyone who is familiar with NokiX would find it useful to be added in the processing list as an additional enhancement to DCT-3 models. thanks for giving some updates regarding your project. just keep on keeping on :-)
g3gg0
16-12-2005, 10:53 PM
dont know if nokia allows that :)
i mean, u dont need to malloc (if its possible)...
better to use a spareblock as u also said :)
maybe its really better to either use FFS from MADos and provide the
commands to nokix... since it will surely happen more often, that u need some space
and the EEPROM is not very big
deadspot
21-01-2006, 04:03 AM
all:
This project/script will not be released untill i get my hands on the new NokiX SDK V2 as the file system will be added as a nokix sub system so other script writers have access to file read and write routines for there own scripts.
hi Mr.S3...
NOKIX SDK V2 already released,when will be your script also release???
Thank you....
Powered by vBulletin® Version 4.2.0 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.