Hi,
I am trying to use the Keil specified steps in http://www.keil.com/support/docs/494.htm to generate checksum after I compile the code. I get following messages from Keil and wonder what I am doing wrong?
Program Size: data=50.5 xdata=0 code=2675 creating hex file from "..\output\bit_adc"... User command #1: "C:\Documents and Settings\fsiavoshi\My Documents\AC_Smart\Software\PhaseProc\BIT_ADC\source\genchksum.bat" C:\Documents and Settings\fsiavoshi\My Documents\AC_Smart\Software\PhaseProc\BIT_ADC\project>hex2bin bit_adc.hex /Q The system cannot execute the specified program. C:\Documents and Settings\fsiavoshi\My Documents\AC_Smart\Software\PhaseProc\BIT_ADC\project>check8 bit_adc.bin /s0x0000 /e0x7FFE /p0x7FFF /v0x80 The system cannot execute the specified program. C:\Documents and Settings\fsiavoshi\My Documents\AC_Smart\Software\PhaseProc\BIT_ADC\project>bin2hex bit_adc.bin a.hex /Q The system cannot execute the specified program. "..\output\bit_adc" - 0 Error(s), 1 Warning(s).\
Please let me know.
Thanks
I'm not sure what your exact problems are, but I do note that you are using a directory path containing spaces. For a good many years, spaces in directory names have created lots of havoc for a lot of users, since many library functions splits the command line at every space suddenly making part of the path to the binary into parameters.
As a general rule, you should always try to avoid spaces in directory names. Somewhere along the line, you will get hurt. If not today, then tomorrow, next week or next year. But the world is full of applications that forgets to put the paths in quotes or in other ways make sure that they don't get splitted.
Continuing from follow up question randomly placed in thread: http://www.keil.com/forum/18452/
Note that unwritten flash memory for most processors will have the value 0xff.
You don't need to use an absolutely placed variable for the checksum value - you can also use a code pointer set to the value 0x7ffe.
Have you spent any time verifying the byte order for 16-bit integers in PLM/51 yet? Does it match the byte order for C51? If it doesn't, then you need to perform the compare individually for high and low byte instead of playing with a 16-bit integer.
Thanks for your hint as the directory name was the problem and once I took out the spaces, it calculated the checksum but still the match failed. I followed the instruction in csumex.zip and still can not get the checksum to match! Any further idea?
Extra information from Keil to help with understanding the remaining checksum failed issue:
Padding file with 0xFF(s) Calculating checksum from 0x00000000 to 0x00003FFE Checksum = 0xB6 +(0x80) C:\Users\FSIAVO~1\project>bin2hex bitadc.bin bitadc.hex /Q BIN2HEX Version 1.06 Copyright (c) 1993-1995 BITWARE. All rights reserved. "..\output\bitadc" - 0 Error(s), 0 Warning(s). Load "..\\output\\bitadc" Flash Erase Done. Flash Image Update Complete. Beginning programming... Flash Program Done: 2785 bytes programmed. Checksum:0x3487
Not sure how the program works, but your checksum seems to be 16-bit large (0x3487).
So you probably store the checksum at 0x3ffe and 0x3fff. But shouldn't you then compute the checksum between 0x0000 and 0x3ffd? Or is the printout 0x3ffe the first address that isn't part of the checksum?
I added a print statement in the main code to display the calculated checksum as follows:
checksum calculated: 1800
The value expected is 0x80 and that is why I get the failed result. I am not sure how to get the last address where actual code resides in the flash memory. I looked at the .m51 map file and see following but still not sure how to set the start address and end address for checksum calculation?
* * * * * * * C O D E M E M O R Y * * * * * * * CODE 0000H 0003H ABSOLUTE CODE 0003H 0027H UNIT ?PR?PUTCHAR?PUTCHAR 002AH 0001H *** GAP *** CODE 002BH 0003H ABSOLUTE CODE 002EH 035CH UNIT ?PR?PRINTF?PRINTF CODE 038AH 01E3H UNIT ?C?LIB_CODE CODE 056DH 0102H UNIT ?PR?STARTUPCALFNC?MAIN_ADC_EX CODE 066FH 00E8H UNIT ?PR?MAIN?MAIN_ADC_EX CODE 0757H 008CH UNIT ?C_C51STARTUP CODE 07E3H 0067H UNIT ?PR?_STARTUPSTARTCALFNC?MAIN_ADC_EX CODE 084AH 0055H UNIT ?CO?MAIN_ADC_EX CODE 089FH 0044H UNIT ?C?LDIV BL51 BANKED LINKER/LOCATER V6.22 02/23/2011 17:04:54 PAGE 2
CODE 08E3H 002EH UNIT ?PR?ADC0_INIT?INIT CODE 0911H 002DH UNIT ?PR?SPI_ARRAY_WRITE?MAIN_ADC_EX CODE 093EH 001EH UNIT ?PR?_FLASH_BYTEWRITE?MAIN_ADC_EX CODE 095CH 001EH UNIT ?PR?INIT_DEVICE?INIT CODE 097AH 001DH UNIT ?PR?_FLASH_PAGEERASE?MAIN_ADC_EX CODE 0997H 001DH UNIT ?PR?TIMER_INIT?INIT CODE 09B4H 001AH UNIT ?PR?PORT_INIT?INIT CODE 09CEH 0016H UNIT ?PR?MAIN_ADC_EX CODE 09E4H 0013H UNIT ?PR?UART0_INIT?INIT CODE 09F7H 0013H UNIT ?PR?SPI0_INIT?INIT CODE 0A0AH 0012H UNIT ?PR?_FLASH_BYTEREAD?MAIN_ADC_EX CODE 0A1CH 0012H UNIT ?C_INITSEG CODE 0A2EH 0010H UNIT ?PR?INTERRUPT_TIMER2_ISR?MAIN_ADC_EX CODE 0A3EH 000EH UNIT ?PR?SYSCLK_INIT?INIT CODE 0A4CH 000EH UNIT ?PR?VDDMON_INIT?INIT CODE 0A5AH 000BH UNIT ?PR?VOLTAGE_REFERENCE_INIT?INIT CODE 0A65H 000BH UNIT ?PR?PCA0_INIT?INIT CODE 0A70H 0004H UNIT ?PR?INTERRUPTS_INIT?INIT