Topic : absolute address for RAM variables crashes ride7

Forum : ST7/STM8

Original Post
Post Information Post
October 20, 2009 - 6:25pm
Guest

hi

I try to define a variable to a specific address in RAM using at keyword.
when writing:
at 0x0100
u8 boot_flags;

boot_flags is located at 0x100 as expected, but when trying to write:

at 0x0101
u8 flash_data_write_buf[FLASH_WR_BUF_LENGTH];

while FLASH_WR_BUF_LENGTH is defined as "#define FLASH_WR_BUF_LENGTH 131"
the compiler crashes at the "Building C:\Enaltec\Software\Enaltec.rapp" step, gives me the windows xp dialog
"RLSTM8.EXE has encountered a problem and needs to close. We are sorry for the inconvenience."
then choosing "don't send" in windows dialog, the compile continues and give "build failed" message.

tried also using "at 0x0100-0x0182"

and also "u8 flash_data_write_buf[131];"

I'm using a REva starter kit with:
- a REva motherboard v3.3 with RLink
- a REva STM8S208RB daughter board.
- Windows XP, Service Pack 3
- Ride Ver. 7.24.09.0251
- RKit-STM8 Ver. 2.24.09.0238
activated for 16K code.

thank you
Igal

Replies
Post Information Post
+1
0
-1
October 21, 2009 - 8:32am
Raisonance Support Team

Hi Igal,

We did not reproduce your issue here. Here is some code that (should) cause the problem, if I correctly understood your report:

typedef unsigned char u8;

at 0x0100 u8 boot_flags;

#define FLASH_WR_BUF_LENGTH 131
at 0x0101 u8 flash_data_write_buf[FLASH_WR_BUF_LENGTH];

void main(void)
{
    flash_data_write_buf[boot_flags] = 2;
    while(1);
}

This code succesfully compiles and links both in ST7 and STM8 mode, no problem detected.

Can you send us the .lst and .map file that caused the problem, or at least the RCSTM8.exe and RLSTM8.exe command-line that you used?

Thanks,
Bruno

+1
0
-1
October 21, 2009 - 10:16am
Guest

thanks for your reply
I use as index "u8 i;" which is a local variable inside a procedure.
couldn't find a way of attaching files so here is the map file:

RLST7 LINKER/LOCATOR V2.24.09.238

INVOKED BY:
C:\Program Files\Raisonance\Ride\Bin\RLSTM8.EXE -CP
C:\ENALTEC\SOFTWARE\MAIN.OBJ,C:\ENALTEC\SOFTWARE\HARDWARE.OBJ,C:\ENALTEC\SOFTWARE\ADC.OBJ,C:\ENALTEC\SOFTWARE\DATA.OBJ,C:\ENALTEC\SOFTWARE\TIMER2.OBJ,C:\ENALTEC\SOFTWARE\CLOCK_INIT.OBJ,C:\ENALTEC\SOFTWARE\USART.OBJ,C:\ENALTEC\SOFTWARE\FLASH.OBJ,C:\ENALTEC\SOFTWARE\STM8S_ADC2.OBJ,C:\ENALTEC\SOFTWARE\STM8S_FLASH.OBJ,C:\ENALTEC\SOFTWARE\STM8S_TIM2.OBJ,C:\ENALTEC\SOFTWARE\STM8S_CLK.OBJ,C:\ENALTEC\SOFTWARE\STM8S_UART3.OBJ,C:\ENALTEC\SOFTWARE\BOOT.OBJ
TO(C:\ENALTEC\SOFTWARE\ENALTEC.AOF)
LIBPATH(C:\ENALTEC\SOFTWARE\LIBRARY;C:\PROGRAM FILES\RAISONANCE\RIDE\EXAMPLES\STM8\STM8SFWLIB\LIBRARY\INC;C:\PROGRAM FILES\RAISONANCE\RIDE\EXAMPLES\STM8\STM8SFWLIB\LIBRARY\SRC)
PR(C:\ENALTEC\SOFTWARE\ENALTEC.MAP) SCINAME(STM8) GENERATEDEPFILE
CODESIZE(0X20000) CODESTART(0X8000) RAMSIZE(0X1800) DATASTART(0X0000)
EEPROMSTART(0X4000) EEPROMSIZE(0X800) STACKSIZE(0X400) STACKTOP(6144)
REMOVEUNCALLED IX XML(C:\ENALTEC\SOFTWARE\ENALTEC.STM7-LARGE.XML)
XMLRIDE(C:\ENALTEC\SOFTWARE\ENALTEC-GLOBALS.STM7-LARGE.XML)
WITHOUT ANY FLOATING POINT ARITHMETIC

INPUT MODULES INCLUDED
C:\ENALTEC\SOFTWARE\MAIN.OBJ(MAIN)
C:\ENALTEC\SOFTWARE\HARDWARE.OBJ(HARDWARE)
C:\ENALTEC\SOFTWARE\ADC.OBJ(ADC)
C:\ENALTEC\SOFTWARE\DATA.OBJ(DATA)
C:\ENALTEC\SOFTWARE\TIMER2.OBJ(TIMER2)
C:\ENALTEC\SOFTWARE\CLOCK_INIT.OBJ(CLOCK_INIT)
C:\ENALTEC\SOFTWARE\USART.OBJ(USART)
C:\ENALTEC\SOFTWARE\FLASH.OBJ(FLASH)
C:\ENALTEC\SOFTWARE\STM8S_ADC2.OBJ(STM8S_ADC2)
C:\ENALTEC\SOFTWARE\STM8S_FLASH.OBJ(STM8S_FLASH)
C:\ENALTEC\SOFTWARE\STM8S_TIM2.OBJ(STM8S_TIM2)
C:\ENALTEC\SOFTWARE\STM8S_CLK.OBJ(STM8S_CLK)
C:\ENALTEC\SOFTWARE\STM8S_UART3.OBJ(STM8S_UART3)
C:\ENALTEC\SOFTWARE\BOOT.OBJ(BOOT)
C:\PROGRAM FILES\RAISONANCE\RIDE\EXAMPLES\STM8\STM8SFWLIB\LIBRARY\SRC\RCSTM8L.LIB(CHARTOL)
C:\PROGRAM FILES\RAISONANCE\RIDE\EXAMPLES\STM8\STM8SFWLIB\LIBRARY\SRC\RCSTM8L.LIB(ADD3232)
C:\PROGRAM FILES\RAISONANCE\RIDE\EXAMPLES\STM8\STM8SFWLIB\LIBRARY\SRC\RCSTM8L.LIB(AND3232)
C:\PROGRAM FILES\RAISONANCE\RIDE\EXAMPLES\STM8\STM8SFWLIB\LIBRARY\SRC\RCSTM8L.LIB(CPU3232)
C:\PROGRAM FILES\RAISONANCE\RIDE\EXAMPLES\STM8\STM8SFWLIB\LIBRARY\SRC\RCSTM8L.LIB(DIVU3232)
C:\PROGRAM FILES\RAISONANCE\RIDE\EXAMPLES\STM8\STM8SFWLIB\LIBRARY\SRC\RCSTM8L.LIB(MULUIX32)
C:\PROGRAM FILES\RAISONANCE\RIDE\EXAMPLES\STM8\STM8SFWLIB\LIBRARY\SRC\RCSTM8L.LIB(ADDIX32)
C:\PROGRAM FILES\RAISONANCE\RIDE\EXAMPLES\STM8\STM8SFWLIB\LIBRARY\SRC\RCSTM8L.LIB(IX32)
C:\PROGRAM FILES\RAISONANCE\RIDE\EXAMPLES\STM8\STM8SFWLIB\LIBRARY\SRC\RCSTM8L.LIB(MULU3232)
C:\PROGRAM FILES\RAISONANCE\RIDE\EXAMPLES\STM8\STM8SFWLIB\LIBRARY\SRC\RCSTM8L.LIB(MV4_BC2ISA)
C:\PROGRAM FILES\RAISONANCE\RIDE\EXAMPLES\STM8\STM8SFWLIB\LIBRARY\SRC\RCSTM8L.LIB(MV4_BC2SK)
C:\PROGRAM FILES\RAISONANCE\RIDE\EXAMPLES\STM8\STM8SFWLIB\LIBRARY\SRC\RCSTM8L.LIB(MV4_ISA2BC)
C:\PROGRAM FILES\RAISONANCE\RIDE\EXAMPLES\STM8\STM8SFWLIB\LIBRARY\SRC\RCSTM8L.LIB(MV4_NULL2ISA)
C:\PROGRAM FILES\RAISONANCE\RIDE\EXAMPLES\STM8\STM8SFWLIB\LIBRARY\SRC\RCSTM8L.LIB(MV4_PG2BC)
C:\PROGRAM FILES\RAISONANCE\RIDE\EXAMPLES\STM8\STM8SFWLIB\LIBRARY\SRC\RCSTM8L.LIB(MV4_PG2IX1)
C:\PROGRAM FILES\RAISONANCE\RIDE\EXAMPLES\STM8\STM8SFWLIB\LIBRARY\SRC\RCSTM8L.LIB(MV4_PG2SK1)
C:\PROGRAM FILES\RAISONANCE\RIDE\EXAMPLES\STM8\STM8SFWLIB\LIBRARY\SRC\RCSTM8L.LIB(POP4)
C:\PROGRAM FILES\RAISONANCE\RIDE\EXAMPLES\STM8\STM8SFWLIB\LIBRARY\SRC\RCSTM8L.LIB(SLL168)
C:\PROGRAM FILES\RAISONANCE\RIDE\EXAMPLES\STM8\STM8SFWLIB\LIBRARY\SRC\RCSTM8L.LIB(SLL328)
C:\PROGRAM FILES\RAISONANCE\RIDE\EXAMPLES\STM8\STM8SFWLIB\LIBRARY\SRC\RCSTM8L.LIB(SRA168)
C:\PROGRAM FILES\RAISONANCE\RIDE\EXAMPLES\STM8\STM8SFWLIB\LIBRARY\SRC\RCSTM8L.LIB(SUB3232)
C:\PROGRAM FILES\RAISONANCE\RIDE\EXAMPLES\STM8\STM8SFWLIB\LIBRARY\SRC\RCSTM8L.LIB(SRL328)
C:\PROGRAM FILES\RAISONANCE\RIDE\EXAMPLES\STM8\STM8SFWLIB\LIBRARY\SRC\RCSTM8L.LIB(REGISTERS)
C:\PROGRAM FILES\RAISONANCE\RIDE\EXAMPLES\STM8\STM8SFWLIB\LIBRARY\SRC\RCSTM8L.LIB(STARTUP_V_Z)
C:\PROGRAM FILES\RAISONANCE\RIDE\EXAMPLES\STM8\STM8SFWLIB\LIBRARY\SRC\RCSTM8L.LIB(INC_CX)
C:\PROGRAM FILES\RAISONANCE\RIDE\EXAMPLES\STM8\STM8SFWLIB\LIBRARY\SRC\RCSTM8L.LIB(?STATINIT)

REMOVED UNCALLED SEGMENTS:
--------------------------
?FC??ADC2_CLEARFLAG?STM8S_ADC2: Function ?ADC2_CLEARFLAG in file C:\ENALTEC\SOFTWARE\STM8S_ADC2.OBJ was not called
?FC??ADC2_CLEARITPENDINGBIT?STM8S_ADC2: Function ?ADC2_CLEARITPENDINGBIT in file C:\ENALTEC\SOFTWARE\STM8S_ADC2.OBJ was not called
?FC??ADC2_CMD?STM8S_ADC2: Function ?ADC2_CMD in file C:\ENALTEC\SOFTWARE\STM8S_ADC2.OBJ was not called
?FC??ADC2_GETCONVERSIONVALUE?STM8S_ADC2: Function ?ADC2_GETCONVERSIONVALUE in file C:\ENALTEC\SOFTWARE\STM8S_ADC2.OBJ was not called
?FC??ADC2_GETFLAGSTATUS?STM8S_ADC2: Function ?ADC2_GETFLAGSTATUS in file C:\ENALTEC\SOFTWARE\STM8S_ADC2.OBJ was not called
?FC??ADC2_GETITSTATUS?STM8S_ADC2: Function ?ADC2_GETITSTATUS in file C:\ENALTEC\SOFTWARE\STM8S_ADC2.OBJ was not called
?FC??CLK_ADJUSTHSICALIBRATIONVALUE?STM8S_CLK: Function ?CLK_ADJUSTHSICALIBRATIONVALUE in file C:\ENALTEC\SOFTWARE\STM8S_CLK.OBJ was not called
?FC??CLK_CANCONFIG?STM8S_CLK: Function ?CLK_CANCONFIG in file C:\ENALTEC\SOFTWARE\STM8S_CLK.OBJ was not called
?FC??CLK_CCOCMD?STM8S_CLK: Function ?CLK_CCOCMD in file C:\ENALTEC\SOFTWARE\STM8S_CLK.OBJ was not called
?FC??CLK_CCOCONFIG?STM8S_CLK: Function ?CLK_CCOCONFIG in file C:\ENALTEC\SOFTWARE\STM8S_CLK.OBJ was not called
?FC??CLK_CLEARITPENDINGBIT?STM8S_CLK: Function ?CLK_CLEARITPENDINGBIT in file C:\ENALTEC\SOFTWARE\STM8S_CLK.OBJ was not called
?FC??CLK_CLOCKSECURITYSYSTEMENABLE?STM8S_CLK: Function ?CLK_CLOCKSECURITYSYSTEMENABLE in file C:\ENALTEC\SOFTWARE\STM8S_CLK.OBJ was not called
?FC??CLK_CLOCKSWITCHCMD?STM8S_CLK: Function ?CLK_CLOCKSWITCHCMD in file C:\ENALTEC\SOFTWARE\STM8S_CLK.OBJ was not called
?FC??CLK_CLOCKSWITCHCONFIG?STM8S_CLK: Function ?CLK_CLOCKSWITCHCONFIG in file C:\ENALTEC\SOFTWARE\STM8S_CLK.OBJ was not called
?FC??CLK_GETFLAGSTATUS?STM8S_CLK: Function ?CLK_GETFLAGSTATUS in file C:\ENALTEC\SOFTWARE\STM8S_CLK.OBJ was not called
?FC??CLK_GETITSTATUS?STM8S_CLK: Function ?CLK_GETITSTATUS in file C:\ENALTEC\SOFTWARE\STM8S_CLK.OBJ was not called
?FC??CLK_GETSYSCLKSOURCE?STM8S_CLK: Function ?CLK_GETSYSCLKSOURCE in file C:\ENALTEC\SOFTWARE\STM8S_CLK.OBJ was not called
?FC??CLK_HSECMD?STM8S_CLK: Function ?CLK_HSECMD in file C:\ENALTEC\SOFTWARE\STM8S_CLK.OBJ was not called
?FC??CLK_HSICMD?STM8S_CLK: Function ?CLK_HSICMD in file C:\ENALTEC\SOFTWARE\STM8S_CLK.OBJ was not called
?FC??CLK_ITCONFIG?STM8S_CLK: Function ?CLK_ITCONFIG in file C:\ENALTEC\SOFTWARE\STM8S_CLK.OBJ was not called
?FC??CLK_LSICMD?STM8S_CLK: Function ?CLK_LSICMD in file C:\ENALTEC\SOFTWARE\STM8S_CLK.OBJ was not called
?FC??CLK_PERIPHERALCLOCKCONFIG?STM8S_CLK: Function ?CLK_PERIPHERALCLOCKCONFIG in file C:\ENALTEC\SOFTWARE\STM8S_CLK.OBJ was not called
?FC??CLK_SLOWACTIVEHALTWAKEUPCMD?STM8S_CLK: Function ?CLK_SLOWACTIVEHALTWAKEUPCMD in file C:\ENALTEC\SOFTWARE\STM8S_CLK.OBJ was not called
?FC??CLK_SWIMCONFIG?STM8S_CLK: Function ?CLK_SWIMCONFIG in file C:\ENALTEC\SOFTWARE\STM8S_CLK.OBJ was not called
?FC??CLK_SYSCLKCONFIG?STM8S_CLK: Function ?CLK_SYSCLKCONFIG in file C:\ENALTEC\SOFTWARE\STM8S_CLK.OBJ was not called
?FC??CLK_SYSCLKEMERGENCYCLEAR?STM8S_CLK: Function ?CLK_SYSCLKEMERGENCYCLEAR in file C:\ENALTEC\SOFTWARE\STM8S_CLK.OBJ was not called
?FC??EXTI_DEINIT?HARDWARE: Function ?EXTI_DEINIT in file C:\ENALTEC\SOFTWARE\HARDWARE.OBJ was not called
?FC??EXTI_GETEXTINTSENSITIVITY?HARDWARE: Function ?EXTI_GETEXTINTSENSITIVITY in file C:\ENALTEC\SOFTWARE\HARDWARE.OBJ was not called
?FC??EXTI_GETTLISENSITIVITY?HARDWARE: Function ?EXTI_GETTLISENSITIVITY in file C:\ENALTEC\SOFTWARE\HARDWARE.OBJ was not called
?FC??EXTI_SETTLISENSITIVITY?HARDWARE: Function ?EXTI_SETTLISENSITIVITY in file C:\ENALTEC\SOFTWARE\HARDWARE.OBJ was not called
?FC??FLASH_DEINIT?STM8S_FLASH: Function ?FLASH_DEINIT in file C:\ENALTEC\SOFTWARE\STM8S_FLASH.OBJ was not called
?FC??FLASH_ERASEBLOCK?STM8S_FLASH: Function ?FLASH_ERASEBLOCK in file C:\ENALTEC\SOFTWARE\STM8S_FLASH.OBJ was not called
?FC??FLASH_ERASEBYTE?STM8S_FLASH: Function ?FLASH_ERASEBYTE in file C:\ENALTEC\SOFTWARE\STM8S_FLASH.OBJ was not called
?FC??FLASH_ERASEOPTIONBYTE?STM8S_FLASH: Function ?FLASH_ERASEOPTIONBYTE in file C:\ENALTEC\SOFTWARE\STM8S_FLASH.OBJ was not called
?FC??FLASH_GETBOOTSIZE?STM8S_FLASH: Function ?FLASH_GETBOOTSIZE in file C:\ENALTEC\SOFTWARE\STM8S_FLASH.OBJ was not called
?FC??FLASH_GETFLAGSTATUS?STM8S_FLASH: Function ?FLASH_GETFLAGSTATUS in file C:\ENALTEC\SOFTWARE\STM8S_FLASH.OBJ was not called
?FC??FLASH_GETLOWPOWERMODE?STM8S_FLASH: Function ?FLASH_GETLOWPOWERMODE in file C:\ENALTEC\SOFTWARE\STM8S_FLASH.OBJ was not called
?FC??FLASH_GETPROGRAMMINGTIME?STM8S_FLASH: Function ?FLASH_GETPROGRAMMINGTIME in file C:\ENALTEC\SOFTWARE\STM8S_FLASH.OBJ was not called
?FC??FLASH_ITCONFIG?STM8S_FLASH: Function ?FLASH_ITCONFIG in file C:\ENALTEC\SOFTWARE\STM8S_FLASH.OBJ was not called
?FC??FLASH_LOCK?STM8S_FLASH: Function ?FLASH_LOCK in file C:\ENALTEC\SOFTWARE\STM8S_FLASH.OBJ was not called
?FC??FLASH_PROGRAMBLOCK?STM8S_FLASH: Function ?FLASH_PROGRAMBLOCK in file C:\ENALTEC\SOFTWARE\STM8S_FLASH.OBJ was not called
?FC??FLASH_PROGRAMBYTE?STM8S_FLASH: Function ?FLASH_PROGRAMBYTE in file C:\ENALTEC\SOFTWARE\STM8S_FLASH.OBJ was not called
?FC??FLASH_PROGRAMOPTIONBYTE?STM8S_FLASH: Function ?FLASH_PROGRAMOPTIONBYTE in file C:\ENALTEC\SOFTWARE\STM8S_FLASH.OBJ was not called
?FC??FLASH_PROGRAMWORD?STM8S_FLASH: Function ?FLASH_PROGRAMWORD in file C:\ENALTEC\SOFTWARE\STM8S_FLASH.OBJ was not called
?FC??FLASH_READBYTE?STM8S_FLASH: Function ?FLASH_READBYTE in file C:\ENALTEC\SOFTWARE\STM8S_FLASH.OBJ was not called
?FC??FLASH_READOPTIONBYTE?STM8S_FLASH: Function ?FLASH_READOPTIONBYTE in file C:\ENALTEC\SOFTWARE\STM8S_FLASH.OBJ was not called
?FC??FLASH_SETLOWPOWERMODE?STM8S_FLASH: Function ?FLASH_SETLOWPOWERMODE in file C:\ENALTEC\SOFTWARE\STM8S_FLASH.OBJ was not called
?FC??FLASH_SETPROGRAMMINGTIME?STM8S_FLASH: Function ?FLASH_SETPROGRAMMINGTIME in file C:\ENALTEC\SOFTWARE\STM8S_FLASH.OBJ was not called
?FC??FLASH_UNLOCK?STM8S_FLASH: Function ?FLASH_UNLOCK in file C:\ENALTEC\SOFTWARE\STM8S_FLASH.OBJ was not called
?FC??FLASH_WAITFORLASTOPERATION?STM8S_FLASH: Function ?FLASH_WAITFORLASTOPERATION in file C:\ENALTEC\SOFTWARE\STM8S_FLASH.OBJ was not called
?FC??NONHANDLEDINTERRUPT?MAIN: Function ?NONHANDLEDINTERRUPT in file C:\ENALTEC\SOFTWARE\MAIN.OBJ was not called
?FC??TI1_CONFIG?STM8S_TIM2?S?STM8S_TIM2: Function ?TI1_CONFIG in file C:\ENALTEC\SOFTWARE\STM8S_TIM2.OBJ was not called
?FC??TI2_CONFIG?STM8S_TIM2?S?STM8S_TIM2: Function ?TI2_CONFIG in file C:\ENALTEC\SOFTWARE\STM8S_TIM2.OBJ was not called
?FC??TI3_CONFIG?STM8S_TIM2?S?STM8S_TIM2: Function ?TI3_CONFIG in file C:\ENALTEC\SOFTWARE\STM8S_TIM2.OBJ was not called
?FC??TIM2_ARRPRELOADCONFIG?STM8S_TIM2: Function ?TIM2_ARRPRELOADCONFIG in file C:\ENALTEC\SOFTWARE\STM8S_TIM2.OBJ was not called
?FC??TIM2_CCXCMD?STM8S_TIM2: Function ?TIM2_CCXCMD in file C:\ENALTEC\SOFTWARE\STM8S_TIM2.OBJ was not called
?FC??TIM2_CLEARFLAG?STM8S_TIM2: Function ?TIM2_CLEARFLAG in file C:\ENALTEC\SOFTWARE\STM8S_TIM2.OBJ was not called
?FC??TIM2_FORCEDOC1CONFIG?STM8S_TIM2: Function ?TIM2_FORCEDOC1CONFIG in file C:\ENALTEC\SOFTWARE\STM8S_TIM2.OBJ was not called
?FC??TIM2_FORCEDOC2CONFIG?STM8S_TIM2: Function ?TIM2_FORCEDOC2CONFIG in file C:\ENALTEC\SOFTWARE\STM8S_TIM2.OBJ was not called
?FC??TIM2_FORCEDOC3CONFIG?STM8S_TIM2: Function ?TIM2_FORCEDOC3CONFIG in file C:\ENALTEC\SOFTWARE\STM8S_TIM2.OBJ was not called
?FC??TIM2_GENERATEEVENT?STM8S_TIM2: Function ?TIM2_GENERATEEVENT in file C:\ENALTEC\SOFTWARE\STM8S_TIM2.OBJ was not called
?FC??TIM2_GETCAPTURE1?STM8S_TIM2: Function ?TIM2_GETCAPTURE1 in file C:\ENALTEC\SOFTWARE\STM8S_TIM2.OBJ was not called
?FC??TIM2_GETCAPTURE2?STM8S_TIM2: Function ?TIM2_GETCAPTURE2 in file C:\ENALTEC\SOFTWARE\STM8S_TIM2.OBJ was not called
?FC??TIM2_GETCAPTURE3?STM8S_TIM2: Function ?TIM2_GETCAPTURE3 in file C:\ENALTEC\SOFTWARE\STM8S_TIM2.OBJ was not called
?FC??TIM2_GETCOUNTER?STM8S_TIM2: Function ?TIM2_GETCOUNTER in file C:\ENALTEC\SOFTWARE\STM8S_TIM2.OBJ was not called
?FC??TIM2_GETFLAGSTATUS?STM8S_TIM2: Function ?TIM2_GETFLAGSTATUS in file C:\ENALTEC\SOFTWARE\STM8S_TIM2.OBJ was not called
?FC??TIM2_GETITSTATUS?STM8S_TIM2: Function ?TIM2_GETITSTATUS in file C:\ENALTEC\SOFTWARE\STM8S_TIM2.OBJ was not called
?FC??TIM2_GETPRESCALER?STM8S_TIM2: Function ?TIM2_GETPRESCALER in file C:\ENALTEC\SOFTWARE\STM8S_TIM2.OBJ was not called
?FC??TIM2_ICINIT?STM8S_TIM2: Function ?TIM2_ICINIT in file C:\ENALTEC\SOFTWARE\STM8S_TIM2.OBJ was not called
?FC??TIM2_OC1INIT?STM8S_TIM2: Function ?TIM2_OC1INIT in file C:\ENALTEC\SOFTWARE\STM8S_TIM2.OBJ was not called
?FC??TIM2_OC1POLARITYCONFIG?STM8S_TIM2: Function ?TIM2_OC1POLARITYCONFIG in file C:\ENALTEC\SOFTWARE\STM8S_TIM2.OBJ was not called
?FC??TIM2_OC1PRELOADCONFIG?STM8S_TIM2: Function ?TIM2_OC1PRELOADCONFIG in file C:\ENALTEC\SOFTWARE\STM8S_TIM2.OBJ was not called
?FC??TIM2_OC2POLARITYCONFIG?STM8S_TIM2: Function ?TIM2_OC2POLARITYCONFIG in file C:\ENALTEC\SOFTWARE\STM8S_TIM2.OBJ was not called
?FC??TIM2_OC2PRELOADCONFIG?STM8S_TIM2: Function ?TIM2_OC2PRELOADCONFIG in file C:\ENALTEC\SOFTWARE\STM8S_TIM2.OBJ was not called
?FC??TIM2_OC3INIT?STM8S_TIM2: Function ?TIM2_OC3INIT in file C:\ENALTEC\SOFTWARE\STM8S_TIM2.OBJ was not called
?FC??TIM2_OC3POLARITYCONFIG?STM8S_TIM2: Function ?TIM2_OC3POLARITYCONFIG in file C:\ENALTEC\SOFTWARE\STM8S_TIM2.OBJ was not called
?FC??TIM2_OC3PRELOADCONFIG?STM8S_TIM2: Function ?TIM2_OC3PRELOADCONFIG in file C:\ENALTEC\SOFTWARE\STM8S_TIM2.OBJ was not called
?FC??TIM2_PRESCALERCONFIG?STM8S_TIM2: Function ?TIM2_PRESCALERCONFIG in file C:\ENALTEC\SOFTWARE\STM8S_TIM2.OBJ was not called
?FC??TIM2_PWMICONFIG?STM8S_TIM2: Function ?TIM2_PWMICONFIG in file C:\ENALTEC\SOFTWARE\STM8S_TIM2.OBJ was not called
?FC??TIM2_SELECTOCXM?STM8S_TIM2: Function ?TIM2_SELECTOCXM in file C:\ENALTEC\SOFTWARE\STM8S_TIM2.OBJ was not called
?FC??TIM2_SELECTONEPULSEMODE?STM8S_TIM2: Function ?TIM2_SELECTONEPULSEMODE in file C:\ENALTEC\SOFTWARE\STM8S_TIM2.OBJ was not called
?FC??TIM2_SETAUTORELOAD?STM8S_TIM2: Function ?TIM2_SETAUTORELOAD in file C:\ENALTEC\SOFTWARE\STM8S_TIM2.OBJ was not called
?FC??TIM2_SETCOMPARE1?STM8S_TIM2: Function ?TIM2_SETCOMPARE1 in file C:\ENALTEC\SOFTWARE\STM8S_TIM2.OBJ was not called
?FC??TIM2_SETCOMPARE2?STM8S_TIM2: Function ?TIM2_SETCOMPARE2 in file C:\ENALTEC\SOFTWARE\STM8S_TIM2.OBJ was not called
?FC??TIM2_SETCOMPARE3?STM8S_TIM2: Function ?TIM2_SETCOMPARE3 in file C:\ENALTEC\SOFTWARE\STM8S_TIM2.OBJ was not called
?FC??TIM2_SETCOUNTER?STM8S_TIM2: Function ?TIM2_SETCOUNTER in file C:\ENALTEC\SOFTWARE\STM8S_TIM2.OBJ was not called
?FC??TIM2_SETIC1PRESCALER?STM8S_TIM2: Function ?TIM2_SETIC1PRESCALER in file C:\ENALTEC\SOFTWARE\STM8S_TIM2.OBJ was not called
?FC??TIM2_SETIC2PRESCALER?STM8S_TIM2: Function ?TIM2_SETIC2PRESCALER in file C:\ENALTEC\SOFTWARE\STM8S_TIM2.OBJ was not called
?FC??TIM2_SETIC3PRESCALER?STM8S_TIM2: Function ?TIM2_SETIC3PRESCALER in file C:\ENALTEC\SOFTWARE\STM8S_TIM2.OBJ was not called
?FC??TIM2_UPDATEDISABLECONFIG?STM8S_TIM2: Function ?TIM2_UPDATEDISABLECONFIG in file C:\ENALTEC\SOFTWARE\STM8S_TIM2.OBJ was not called
?FC??TIM2_UPDATEREQUESTCONFIG?STM8S_TIM2: Function ?TIM2_UPDATEREQUESTCONFIG in file C:\ENALTEC\SOFTWARE\STM8S_TIM2.OBJ was not called
?FC??TRAP_IRQHANDLER?MAIN: Function ?TRAP_IRQHANDLER in file C:\ENALTEC\SOFTWARE\MAIN.OBJ was not called
?FC??UART3_CLEARFLAG?STM8S_UART3: Function ?UART3_CLEARFLAG in file C:\ENALTEC\SOFTWARE\STM8S_UART3.OBJ was not called
?FC??UART3_CMD?STM8S_UART3: Function ?UART3_CMD in file C:\ENALTEC\SOFTWARE\STM8S_UART3.OBJ was not called
?FC??UART3_GETFLAGSTATUS?STM8S_UART3: Function ?UART3_GETFLAGSTATUS in file C:\ENALTEC\SOFTWARE\STM8S_UART3.OBJ was not called
?FC??UART3_GETITSTATUS?STM8S_UART3: Function ?UART3_GETITSTATUS in file C:\ENALTEC\SOFTWARE\STM8S_UART3.OBJ was not called
?FC??UART3_ITCONFIG?STM8S_UART3: Function ?UART3_ITCONFIG in file C:\ENALTEC\SOFTWARE\STM8S_UART3.OBJ was not called
?FC??UART3_LINBREAKDETECTIONCONFIG?STM8S_UART3: Function ?UART3_LINBREAKDETECTIONCONFIG in file C:\ENALTEC\SOFTWARE\STM8S_UART3.OBJ was not called
?FC??UART3_LINCMD?STM8S_UART3: Function ?UART3_LINCMD in file C:\ENALTEC\SOFTWARE\STM8S_UART3.OBJ was not called
?FC??UART3_LINCONFIG?STM8S_UART3: Function ?UART3_LINCONFIG in file C:\ENALTEC\SOFTWARE\STM8S_UART3.OBJ was not called
?FC??UART3_RECEIVEDATA8?STM8S_UART3: Function ?UART3_RECEIVEDATA8 in file C:\ENALTEC\SOFTWARE\STM8S_UART3.OBJ was not called
?FC??UART3_RECEIVEDATA9?STM8S_UART3: Function ?UART3_RECEIVEDATA9 in file C:\ENALTEC\SOFTWARE\STM8S_UART3.OBJ was not called
?FC??UART3_RECEIVERWAKEUPCMD?STM8S_UART3: Function ?UART3_RECEIVERWAKEUPCMD in file C:\ENALTEC\SOFTWARE\STM8S_UART3.OBJ was not called
?FC??UART3_SENDBREAK?STM8S_UART3: Function ?UART3_SENDBREAK in file C:\ENALTEC\SOFTWARE\STM8S_UART3.OBJ was not called
?FC??UART3_SENDDATA8?STM8S_UART3: Function ?UART3_SENDDATA8 in file C:\ENALTEC\SOFTWARE\STM8S_UART3.OBJ was not called
?FC??UART3_SENDDATA9?STM8S_UART3

this is the lst file of the data file which holds all variables:

RCSTM8 COMPILER V2.24.09.238, DATA 10/21/09 09:25:46

QCW(0x009A78A0)

RCSTM8 COMPILER V2.24.09.238, COMPILATION OF MODULE DATA
OBJECT MODULE PLACED IN C:\Enaltec\Software\data.obj
COMPILER INVOKED BY: QUIET GENERATEDEPFILE CODE DB OJ(C:\Enaltec\Software\data.obj) PR(C:\Enaltec\Software\data.lst) PIN(C:\Enaltec\Software;C:\Program Files\Raisonance\Ride\Examples\STM8\STM8SFWLib\library\inc;C:\Program Files\Raisonance\Ride\Examples\STM8\STM8SFWLib\library\src) STM8(LARGE) DGC(DATA) O(0,SIZE) NOINITSTATICVAR SMALLOBJECT ET(INT)

stmt level source
1 #include
2 #include
3
4 u8 conversion_completed;
5 u16 output_voltage_buf;
6 u16 input_voltage_buf;
7 u16 current_measurement_buf;
8 u16 output_voltage;
9 u16 input_voltage;
10 u16 current_measurement;
11 u16 cap_measurement;
12 u16 light_sensor;
13 u16 transformer_temp;
14 u16 switch_analog;
15 u8 converted_channel;
16 u8 timer_610_set;
17 /*usart_rx_buf
18 byte 0 - command defined index - BUF_COMMAND
19 byte 1 - start of data defined index - BUF_DATS_STR
20 byte 21 - checksum defined index - BUF_CHECKSUM*/
21 u8 usart_rx_buf[BUF_LENGTH];
22 u8 usart_rx_cnt;
23 /*usart_tx_buf
24 byte 0 - command defined index - BUF_COMMAND
25 byte 1 - start of data defined index - BUF_DATS_STR
26 byte 21 - checksum defined index - BUF_CHECKSUM*/
27 u8 usart_tx_buf[BUF_LENGTH];
28 u8 usart_tx_cnt;
29 u8 local_flags1;
30 u8 infinite_loop_running;
31 /*flash_data_write_buf
32 byte 0 - command defined index - FLASH_WR_BUF_COMMAND
33 byte 1 - pack number defined index - FLASH_WR_BUF_PACK_NO
34 byte 2-129 - data to flash defined index - FLASH_WR_BUF_STR_DATA
35 byte 130 - checksum defined index - FLASH_WR_BUF_CHECKSUM
36 checksum of the buffer do not include the command and pack number bytes*/
37
38 at 0x101
39 u8 flash_data_write_buf[FLASH_WR_BUF_LENGTH]; /*in boot*/
40 at 0x100
41 u8 boot_flags; /*in boot*/
42 u8 erase_code; /*in boot*/
43 u8 number_of_blocks; /*in boot*/
44 u8 pack_number; /*in boot*/
45 u8 device_program_state;
46 u8 boot_program_error_counter;
47
RCSTM8 COMPILER V2.24.09.238
ASSEMBLY LISTING OF GENERATED OBJECT CODE

RCSTM8 COMPILER V2.24.09.238

MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = ---- ----
CONSTANT SIZE = ---- ----
DATA SIZE = 76 ----
PAGE0 SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.

RCSTM8 COMPILATION COMPLETE. 0 WARNING, 0 ERROR

thanks
Igal

+1
0
-1
October 21, 2009 - 10:21am
Guest

and list file of boot file which uses the buffer flash_data_write_buf

RCSTM8 COMPILER V2.24.09.238, BOOT 10/21/09 09:25:54

QCW(0x009A78A0)

RCSTM8 COMPILER V2.24.09.238, COMPILATION OF MODULE BOOT
OBJECT MODULE PLACED IN C:\Enaltec\Software\boot.obj
COMPILER INVOKED BY: QUIET GENERATEDEPFILE CODE DB OJ(C:\Enaltec\Software\boot.obj) PR(C:\Enaltec\Software\boot.lst) PIN(C:\Enaltec\Software;C:\Program Files\Raisonance\Ride\Examples\STM8\STM8SFWLib\library\inc;C:\Program Files\Raisonance\Ride\Examples\STM8\STM8SFWLib\library\src) STM8(LARGE) DGC(DATA) O(0,SIZE) NOINITSTATICVAR SMALLOBJECT ET(INT)

stmt level source
1
2 #include
3 #include
4 #include
5 #include
6 #include
7 #include
8 #include
9
10 at 0x8080 code
11 void boot_process(void)
12 {
13 1 u8 i;
14 1 u8 checksum;
15 1 u32 boot_block_erase_add;
16 1
17 1 while (boot_flags & BOOTLOADER_MODE) //while this bit is set we are still in boot loader sequence
18 1 {
19 2 if (boot_flags & RECEIVE_COMPLETE) //buffer received from USART - flash_data_write_buf is used
20 2 {
21 3 boot_flags &= ~RECEIVE_COMPLETE;
22 3 checksum = 0;
23 3 for (i=0; i<(FLASH_WR_BUF_LENGTH - FLASH_WR_BUF_STR_DATA); i++) //checking checksum
24 3 checksum += flash_data_write_buf[FLASH_WR_BUF_STR_DATA + i];
25 3 if (checksum != flash_data_write_buf[FLASH_WR_BUF_CHECKSUM])
26 3 {
27 4 while (!(UART3->SR & TR_BUF_EMPTY)); //wait for transmit buffer to be empty
28 4 UART3->DR = 'N'; //wrong checksum received
29 4 }
30 3 else
31 3 { //start of command reception
32 4 switch (flash_data_write_buf[FLASH_WR_BUF_COMMAND]) //checking the received command byte
33 4 {
34 5 case RECEIVE_LENGTH: //receive number of blocks to erase / write
35 5 number_of_blocks = flash_data_write_buf[FLASH_WR_BUF_STR_DATA]; //number of blocks in the first data byte
36 5 while (!(UART3->SR & TR_BUF_EMPTY)); //wait for transmit buffer to be empty
37 5 UART3->DR = number_of_blocks; //send number of blocks received as confirm
38 5 while (!(UART3->SR & TR_BUF_EMPTY)); //wait for transmit buffer to be empty
39 5 UART3->DR = 'Y'; //send 'Y' to indicate data pass ok
40 5 pack_number = 0; //reseting pack number
41 5 boot_block_erase_add = 0; //erase the block address to be erased
42 5 break;
43 5 case ERASE_BLOCKS: //erase selected block command
44 5 erase_code = flash_data_write_buf[FLASH_WR_BUF_STR_DATA]; //first data byte should have erase code
45 5 pack_number = 0; //in case write command failed and erase cycle restarted
46 5 if (erase_code != ERASE_BLOCKS_CODE)
47 5 { //wrong erase code
48 6 while (!(UART3->SR & TR_BUF_EMPTY)); //wait for transmit buffer to be empty
49 6 UART3->DR = erase_code; //send the wrong erase code back
50 6 while (!(UART3->SR & TR_BUF_EMPTY)); //wait for transmit buffer to be empty
51 6 UART3->DR = 'N'; //'N' to indicate wrong command reception
52 6 }
53 5 else
54 5 { //earse command ok - erasing blocks
55 6 for (i=0; iSR & TR_BUF_EMPTY)); //wait for transmit buffer to be empty
62 8 UART3->DR = erase_code; //send erase code back to indicate state
63 8 while (!(UART3->SR & TR_BUF_EMPTY)); //wait for transmit buffer to be empty
64 8 UART3->DR = ERASE_FAILED; //send ERASE_FAILED code
65 8 boot_flags &= BOOTLOADER_MODE; //clear error bits
66 8 break;
67 8 }
68 7 }
69 6 while (!(UART3->SR & TR_BUF_EMPTY)); //wait for transmit buffer to be empty
70 6 UART3->DR = erase_code; //send erase code to indicate the state
71 6 while (!(UART3->SR & TR_BUF_EMPTY)); //wait for transmit buffer to be empty
72 6 UART3->DR = 'Y'; //send 'Y' to indicate erase finished successfully
73 6 boot_block_erase_add = 0; //erase the block address to be erased
74 6 }
75 5 break;
76 5 case RECEIVE_BLOCKS: //receive block to program command
77 5 if (pack_number == flash_data_write_buf[FLASH_WR_BUF_PACK_NO]) //verify no repeatition of pack
78 5 {
79 6 boot_block_erase_add = (pack_number << 7) + PROGRAM_START_ADDRESS; //each block is 128 bytes and so, add=no of block * 128 + start address of the software
80 6 boot_flags |= write_flash_block (boot_block_erase_add, PR_FLASH); //if no errors boot_flags should have only BOOTLOADER_MODE bit set
81 6 if ((boot_flags & BOOTLOADER_MODE) != BOOTLOADER_MODE)
82 6 { //write failed, procedure returns with error
83 7 while (!(UART3->SR & TR_BUF_EMPTY)); //wait for transmit buffer to be empty
84 7 UART3->DR = RECEIVE_BLOCKS; //send command received as indication to failed state
85 7 while (!(UART3->SR & TR_BUF_EMPTY)); //wait for transmit buffer to be empty
86 7 UART3->DR = 'N'; //send 'N' to indicate of fail
87 7 boot_flags &= BOOTLOADER_MODE; //clear error bits
88 7 }
89 6 else
90 6 { //write completed successfuly
91 7 while (!(UART3->SR & TR_BUF_EMPTY)); //wait for transmit buffer to be empty
92 7 UART3->DR = RECEIVE_BLOCKS; //send number of blocks received as confirm
93 7 while (!(UART3->SR & TR_BUF_EMPTY)); //wait for transmit buffer to be empty
94 7 UART3->DR = 'Y'; //send 'Y' as indication of successful write
95 7 boot_flags &= BOOTLOADER_MODE; //clear error bits
96 7 if (pack_number == (number_of_blocks - 1)) //check if it is the last block
97 7 boot_flags &= ~BOOTLOADER_MODE; //if last block received - exit bootloader mode
98 7 else
99 7 pack_number++; //increase pack number to be ready for next block
100 7 }
101 6 }
102 5 else
103 5 { //wrong pack number received
104 6 while (!(UART3->SR & TR_BUF_EMPTY)); //wait for transmit buffer to be empty
105 6 UART3->DR = pack_number; //send expected pack number
106 6 while (!(UART3->SR & TR_BUF_EMPTY)); //wait for transmit buffer to be empty
107 6 UART3->DR = 'P'; //wrong checksum received
108 6 }
109 5 break;
110 5 } //switch (flash_data_write_buf[FLASH_WR_BUF_STR_DATA])
111 4 } //end of command reception
112 3 } //if (boot_flags & RECEIVE_COMPLETE)
113 2 } //while (boot_flags & BOOTLOADER_MODE)
114 1 _jmp_(main); // Absolute jump to main (should reset SP???)
115 1
116 1 }
117
118 void program_device(void) //clear error counter and device_program_state before calling this procedure
119 {
120 1 u8 i;
121 1 u32 flash_add;
122 1
123 1 while (boot_flags & DEVICE_PR_MODE)
124 1 {
125 2 switch (device_program_state) //should start with 0
126 2 {
127 3 case INIT_DEVICE: //initialize device - send number of blocks
128 3 flash_data_write_buf[FLASH_WR_BUF_COMMAND] = RECEIVE_LENGTH; //receive length command
129 3 flash_data_write_buf[FLASH_WR_BUF_PACK_NO] = 0; //no pack number is used
130 3 flash_data_write_buf[FLASH_WR_BUF_STR_DATA] = NUMBER_OF_FLASH_BLOCK; //number of blocks needed for new software
131 3 for (i=0; i<(FLASH_WR_BUF_LENGTH - FLASH_WR_BUF_STR_DATA); i++) //calculating checksum
132 3 flash_data_write_buf[FLASH_WR_BUF_CHECKSUM] += flash_data_write_buf[FLASH_WR_BUF_STR_DATA + i];
133 3 for (i=0; iSR & TR_BUF_EMPTY)); //wait for transmit buffer to be empty
136 4 UART3->DR = flash_data_write_buf[ i ]; //send the 131 bytes buffer
137 4 }
138 3 device_program_state = CHECK_INIT_COMPLETE; //transition to next state
139 3 break;
140 3 case CHECK_INIT_COMPLETE: //this state checks if length received successfully
141 3 if (local_flags1 & RECEPTION_COMPLETE) //check if 2 bytes received by USART
142 3 {
143 4 local_flags1 &= ~RECEPTION_COMPLETE;
144 4 if ((usart_rx_buf[0] == NUMBER_OF_FLASH_BLOCK) && (usart_rx_buf[0] == 'Y'))
145 4 { //length received successfuly
146 5 device_program_state = ERASE_BLOCK_COMMAND; //transition to next state
147 5 boot_program_error_counter = 0; //clear bootloader error counter
148 5 }
149 4 else
150 4 { //length was not received successfully
151 5 boot_program_error_counter++; //increase error counter
152 5 if (boot_program_error_counter >= 5) //if too many errors occured set error state
153 5 _nop_(); /*enter error handling here*/
154 5 else
155 5 device_program_state = INIT_DEVICE; //try resending software length length
156 5 }
157 4 }
158 3 break;
159 3 case ERASE_BLOCK_COMMAND: //this state send the command to erase the selected blocks
160 3 flash_data_write_buf[FLASH_WR_BUF_COMMAND] = ERASE_BLOCKS; //blocks erase command
161 3 flash_data_write_buf[FLASH_WR_BUF_PACK_NO] = 0; //no pack number is used
162 3 flash_data_write_buf[FLASH_WR_BUF_STR_DATA] = ERASE_BLOCKS_CODE; //verification code for erasing blocks
163 3 for (i=0; i<(FLASH_WR_BUF_LENGTH - FLASH_WR_BUF_STR_DATA); i++) //calculating checksum
164 3 flash_data_write_buf[FLASH_WR_BUF_CHECKSUM] += flash_data_write_buf[FLASH_WR_BUF_STR_DATA + i];
165 3 for (i=0; iSR & TR_BUF_EMPTY)); //wait for transmit buffer to be empty
168 4 UART3->DR = flash_data_write_buf[ i ]; //send the 131 bytes buffer
169 4 }
170 3 device_program_state = CHECK_ERASE_COMPLETE; //transition to next state
171 3 break;
172 3 case CHECK_ERASE_COMPLETE: //this state verifies block erase completed successfully
173 3 if (local_flags1 & RECEPTION_COMPLETE) //check if 2 bytes received by USART
174 3 {
175 4 local_flags1 &= ~RECEPTION_COMPLETE;
176 4 if ((usart_rx_buf[0] == ERASE_BLOCKS_CODE) && (usart_rx_buf[1] == 'Y'))
177 4 { //erase command received and executed successfuly
178 5 device_program_state = SEND_NEXT_BLOCK; //transition to next state
179 5 flash_add = PROGRAM_START_ADDRESS; //address of the begining of the software to be sent
180 5 boot_program_error_counter = 0; //clear bootloader error counter
181 5 pack_number = 0; //clear pack number counter
182 5 }
183 4 else
184 4 { //erase failed
185 5 boot_program_error_counter++; //increase error counter
186 5 if (boot_program_error_counter >= 5) //if too many errors occured set error state
187 5 _nop_(); /*enter error handling here*/
188 5 else
189 5 device_program_state = ERASE_BLOCK_COMMAND; //send erase command again
190 5 }
191 4 }
192 3 break;
193 3 case SEND_NEXT_BLOCK:
194 3 flash_data_write_buf[FLASH_WR_BUF_COMMAND] = RECEIVE_BLOCKS; //receive block to write command
195 3 flash_data_write_buf[FLASH_WR_BUF_PACK_NO] = pack_number; //current pack number
196 3 for (i=0; i<128; i++)
197 3 {
198 4 flash_data_write_buf[FLASH_WR_BUF_STR_DATA] = *((u8*)flash_add + i); //save current block to buffer
199 4 flash_data_write_buf[FLASH_WR_BUF_CHECKSUM] += *((u8*)flash_add + i); //calculate checksum
200 4 }
201 3 for (i=0; iSR & TR_BUF_EMPTY)); //wait for transmit buffer to be empty
204 4 UART3->DR = flash_data_write_buf[ i ]; //send the 131 bytes buffer
205 4 }
206 3 device_program_state = CHECK_BLOCK_COMPLETE; //transition to next state
207 3 break;
208 3 case CHECK_BLOCK_COMPLETE: //check correct block received and written command
209 3 if (local_flags1 & RECEPTION_COMPLETE) //check if 2 bytes received by USART
210 3 {
211 4 local_flags1 &= ~RECEPTION_COMPLETE;
212 4 if ((usart_rx_buf[0] == RECEIVE_BLOCKS) && (usart_rx_buf[1] == 'Y'))
213 4 { //correct block was received and written successfully
214 5 if (pack_number == (number_of_blocks - 1)) //check if last block was sent
215 5 boot_flags &= ~DEVICE_PR_MODE; //last block was sent - end programming mode
216 5 else
217 5 {
218 6 flash_add += 128; //increase the address by 128 bytes so next block will be collected
219 6 device_program_state = SEND_NEXT_BLOCK; //set next state to send next block
220 6 boot_program_error_counter = 0; //clear bootloader error counter
221 6 pack_number++; //increase the pack number (which also acts as block number-1)
222 6 }
223 5 }
224 4 else
225 4 {
226 5 boot_program_error_counter++; //increase error counter
227 5 if (boot_program_error_counter >= 5) //if too many errors occured set error state
228 5 _nop_(); /*enter error handling here*/
229 5 else
230 5 {
231 6 if ((usart_rx_buf[1] == 'P') && (usart_rx_buf[0] < pack_number)) //wrong pack number received
232 6 { //try sending expected block number in case it is a previous one
233 7 pack_number = usart_rx_buf[0];
234 7 flash_add = (pack_number << 7) + PROGRAM_START_ADDRESS;
235 7 }
236 6 device_program_state = SEND_NEXT_BLOCK; //try resending block
237 6 }
238 5 }
239 4 }
240 3 } //switch (device_program_state)
241 2 } //while (boot_flags & DEVICE_PR_MODE)
242 1 /*end programing state here - return to main loop*/
243 1 }
RCSTM8 COMPILER V2.24.09.238
ASSEMBLY LISTING OF GENERATED OBJECT CODE

; FUNCTION ?boot_process (BEGIN)
; SOURCE LINE # 11
8080 5206 SUB SP,#006H
8082 ?WHILE_0016:
; SOURCE LINE # 17
8082 5F CLRW X
8083 C60000 F LD A,boot_flags
8086 97 LD XL,A
8087 BF02 F LDW ?BH.w,X
8089 720E000403 F BTJT ?BL,#007H,?LAB_0006
808E CC8338 JP ?NXT_0013
8091 ?LAB_0006:
; SOURCE LINE # 19
8091 5500000003 F MOV ?BH,boot_flags
8096 720A000303 F BTJT ?BH,#005H,?LAB_0007
809B CC8335 JP ?NXT_0014
809E ?LAB_0007:
; SOURCE LINE # 21
809E A6DF LD A,#0DFH
80A0 C40000 F AND A,boot_flags
80A3 B703 F LD ?BH,A
80A5 5500030000 F MOV boot_flags,?BH
; SOURCE LINE # 22
80AA A600 LD A,#000H
80AC 6B02 F LD (002H,SP),A ; [ checksum ]
; SOURCE LINE # 23
80AE A600 LD A,#000H
80B0 6B01 F LD (001H,SP),A ; [ i ]
80B2 ?FOR_0002:
; SOURCE LINE # 24
80B2 5F CLRW X
80B3 7B01 F LD A,(001H,SP) ; [ i ]
80B5 97 LD XL,A
80B6 1C0002 ADDW X,#00002H
80B9 7B02 F LD A,(002H,SP) ; [ checksum ]
80BB DB0000 F ADD A,(flash_data_write_buf + 00H,X)
80BE B703 F LD ?BH,A
80C0 B603 F LD A,?BH
80C2 6B02 F LD (002H,SP),A ; [ checksum ]
80C4 ?NXT_0016:
; SOURCE LINE # 23
80C4 7B01 F LD A,(001H,SP) ; [ i ]
80C6 0C01 F INC (001H,SP) ; [ i ]
80C8 5F CLRW X
80C9 7B01 F LD A,(001H,SP) ; [ i ]
80CB 97 LD XL,A
80CC 89 PUSHW X
80CD AE0081 LDW X,#00081H
80D0 9085 POPW Y
80D2 90BF02 F LDW ?BH.w,Y
80D5 B302 F CPW X,?BH.w
80D7 2CD9 JRSGT ?FOR_0002
80D9 ?NXT_0015:
; SOURCE LINE # 25
80D9 7B02 F LD A,(002H,SP) ; [ checksum ]
80DB C10000 F CP A,flash_data_write_buf + 082H
80DE 2713 JREQ ?ELSE_0008
80E0 ?WHILE_0017:
; SOURCE LINE # 27
80E0 5F CLRW X
80E1 C65240 LD A,05240H
80E4 97 LD XL,A
80E5 BF02 F LDW ?BH.w,X
80E7 720F0004F4 F BTJF ?BL,#007H,?WHILE_0017
; SOURCE LINE # 28
80EC 354E5241 MOV 05241H,#04EH
80F0 CC0000 F JP ?NXT_0017
80F3 ?ELSE_0008:
; SOURCE LINE # 32
80F3 5500000003 F MOV ?BH,flash_data_write_buf
80F8 B603 F LD A,?BH
80FA A1A1 CP A,#0A1H
80FC 2716 JREQ ?CASE_0003
80FE ?LAB_0004:
80FE B603 F LD A,?BH
8100 A1B2 CP A,#0B2H
8102 2743 JREQ ?CASE_0004
8104 ?LAB_0005:
8104 5F CLRW X
8105 B603 F LD A,?BH
8107 5F CLRW X
8108 97 LD XL,A
8109 A300D4 CPW X,#000D4H
810C 2603 JRNE ?LAB_0003
810E CC0000 F JP ?CASE_0005
8111 ?LAB_0003:
8111 CC0000 F JP ?NXT_0018
8114 ?CASE_0003:
; SOURCE LINE # 35
8114 5500000000 F MOV number_of_blocks,flash_data_write_buf + 02H
8119 ?WHILE_0018:
; SOURCE LINE # 36
8119 5F CLRW X
811A C65240 LD A,05240H
811D 97 LD XL,A
811E BF02 F LDW ?BH.w,X
8120 720F0004F4 F BTJF ?BL,#007H,?WHILE_0018
; SOURCE LINE # 37
8125 5500005241 F MOV 05241H,number_of_blocks
812A ?WHILE_0019:
; SOURCE LINE # 38
812A 5F CLRW X
812B C65240 LD A,05240H
812E 97 LD XL,A
812F BF02 F LDW ?BH.w,X
8131 720F0004F4 F BTJF ?BL,#007H,?WHILE_0019
; SOURCE LINE # 39
8136 35595241 MOV 05241H,#059H
; SOURCE LINE # 40
813A 35000000 F MOV pack_number,#000H
; SOURCE LINE # 41
813E A602 F LD A,#002H
8140 8D000000 F CALLF ?C?mv4_null2isa
; SOURCE LINE # 42
8144 CC0000 F JP ?NXT_0018
8147 ?CASE_0004:
; SOURCE LINE # 44
8147 5500000000 F MOV erase_code,flash_data_write_buf + 02H
; SOURCE LINE # 45
814C 35000000 F MOV pack_number,#000H
; SOURCE LINE # 46
8150 5F CLRW X
8151 C60000 F LD A,erase_code
8154 97 LD XL,A
8155 89 PUSHW X
8156 AE00E5 LDW X,#000E5H
8159 9085 POPW Y
815B 90BF02 F LDW ?BH.w,Y
815E B302 F CPW X,?BH.w
8160 2724 JREQ ?ELSE_0009
8162 ?WHILE_0020:
; SOURCE LINE # 48
8162 5F CLRW X
8163 C65240 LD A,05240H
8166 97 LD XL,A
8167 BF02 F LDW ?BH.w,X
8169 720F0004F4 F BTJF ?BL,#007H,?WHILE_0020
; SOURCE LINE # 49
816E 5500005241 F MOV 05241H,erase_code
8173 ?WHILE_0021:
; SOURCE LINE # 50
8173 5F CLRW X
8174 C65240 LD A,05240H
8177 97 LD XL,A
8178 BF02 F LDW ?BH.w,X
817A 720F0004F4 F BTJF ?BL,#007H,?WHILE_0021
; SOURCE LINE # 51
817F 354E5241 MOV 05241H,#04EH
8183 CC0000 F JP ?NXT_0019
8186 ?ELSE_0009:
; SOURCE LINE # 55
8186 A600 LD A,#000H
8188 6B01 F LD (001H,SP),A ; [ i ]
818A ?FOR_0003:
818A 7B01 F LD A,(001H,SP) ; [ i ]
818C C10000 F CP A,number_of_blocks
818F 247E JRUGE ?NXT_0020
; SOURCE LINE # 57
8191 905F CLRW Y
8193 7B01 F LD A,(001H,SP) ; [ i ]
8195 9097 LD YL,A
8197 93 LDW X,Y
8198 A680 LD A,#080H
819A 42 MUL X,A
819B 1C9000 ADDW X,#09000H
819E BF05 F LDW ?CH,X
81A0 5F CLRW X
81A1 BF03 F LDW ?BH,X
81A3 A602 F LD A,#002H
81A5 8D000000 F CALLF ?C?mv4_bc2isa
; SOURCE LINE # 58
81A9 4B00 PUSH #000H
81AB 1E06 F LDW X,(006H,SP) ; [ boot_block_erase_add + 02H ]
81AD 89 PUSHW X
81AE 1E06 F LDW X,(006H,SP) ; [ boot_block_erase_add ]
81B0 89 PUSHW X
81B1 8D000000 F CALLF ?erase_flash_block
81B5 5B05 ADD SP,#005H
81B7 CA0000 F OR A,boot_flags
81BA B703 F LD ?BH,A
81BC 5500030000 F MOV boot_flags,?BH
; SOURCE LINE # 59
81C1 5F CLRW X
81C2 C60000 F LD A,boot_flags
81C5 97 LD XL,A
81C6 9F LD A,XL
81C7 A480 AND A,#080H
81C9 88 PUSH A
81CA 9E LD A,XH
81CB A400 AND A,#000H
81CD B703 F LD ?BH,A
81CF 84 POP A
81D0 B704 F LD ?BL,A
81D2 AE0080 LDW X,#00080H
81D5 B302 F CPW X,?BH.w
81D7 272F JREQ ?NXT_0022
81D9 ?WHILE_0022:
; SOURCE LINE # 61
81D9 5F CLRW X
81DA C65240 LD A,05240H
81DD 97 LD XL,A
81DE BF02 F LDW ?BH.w,X
81E0 720F0004F4 F BTJF ?BL,#007H,?WHILE_0022
; SOURCE LINE # 62
81E5 5500005241 F MOV 05241H,erase_code
81EA ?WHILE_0023:
; SOURCE LINE # 63
81EA 5F CLRW X
81EB C65240 LD A,05240H
81EE 97 LD XL,A
81EF BF02 F LDW ?BH.w,X
81F1 720F0004F4 F BTJF ?BL,#007H,?WHILE_0023
; SOURCE LINE # 64
81F6 35C35241 MOV 05241H,#0C3H
; SOURCE LINE # 65
81FA A680 LD A,#080H
81FC C40000 F AND A,boot_flags
81FF B703 F LD ?BH,A
8201 5500030000 F MOV boot_flags,?BH
; SOURCE LINE # 66
8206 2007 JRA ?NXT_0020
8208 ?NXT_0022:

8208 ?NXT_0021:
; SOURCE LINE # 55
8208 7B01 F LD A,(001H,SP) ; [ i ]
820A 0C01 F INC (001H,SP) ; [ i ]
820C CC0000 F JP ?FOR_0003
820F ?NXT_0020:

820F ?WHILE_0024:
; SOURCE LINE # 69
820F 5F CLRW X
8210 C65240 LD A,05240H
8213 97 LD XL,A
8214 BF02 F LDW ?BH.w,X
8216 720F0004F4 F BTJF ?BL,#007H,?WHILE_0024
; SOURCE LINE # 70
821B 5500005241 F MOV 05241H,erase_code
8220 ?WHILE_0025:
; SOURCE LINE # 71
8220 5F CLRW X
8221 C65240 LD A,05240H
8224 97 LD XL,A
8225 BF02 F LDW ?BH.w,X
8227 720F0004F4 F BTJF ?BL,#007H,?WHILE_0025
; SOURCE LINE # 72
822C 35595241 MOV 05241H,#059H
; SOURCE LINE # 73
8230 A602 F LD A,#002H
8232 8D000000 F CALLF ?C?mv4_null2isa
8236 ?NXT_0019:
; SOURCE LINE # 75
8236 CC0000 F JP ?NXT_0018
8239 ?CASE_0005:
; SOURCE LINE # 77
8239 C60000 F LD A,pack_number
823C C10000 F CP A,flash_data_write_buf + 01H
823F 2703 JREQ ?LAB_0008
8241 CC8312 JP ?ELSE_0011
8244 ?LAB_0008:
; SOURCE LINE # 79
8244 905F CLRW Y
8246 C60000 F LD A,pack_number
8249 9097 LD YL,A
824B 93 LDW X,Y
824C A680 LD A,#080H
824E 42 MUL X,A
824F 1C9000 ADDW X,#09000H
8252 BF05 F LDW ?CH,X
8254 5F CLRW X
8255 BF03 F LDW ?BH,X
8257 A602 F LD A,#002H
8259 8D000000 F CALLF ?C?mv4_bc2isa
; SOURCE LINE # 80
825D 4B00 PUSH #000H
825F 1E06 F LDW X,(006H,SP) ; [ boot_block_erase_add + 02H ]
8261 89 PUSHW X
8262 1E06 F LDW X,(006H,SP) ; [ boot_block_erase_add ]
8264 89 PUSHW X
8265 8D000000 F CALLF ?write_flash_block
8269 5B05 ADD SP,#005H
826B CA0000 F OR A,boot_flags
826E B703 F LD ?BH,A
8270 5500030000 F MOV boot_flags,?BH
; SOURCE LINE # 81
8275 5F CLRW X
8276 C60000 F LD A,boot_flags
8279 97 LD XL,A
827A 9F LD A,XL
827B A480 AND A,#080H
827D 88 PUSH A
827E 9E LD A,XH
827F A400 AND A,#000H
8281 B703 F LD ?BH,A
8283 84 POP A
8284 B704 F LD ?BL,A
8286 AE0080 LDW X,#00080H
8289 B302 F CPW X,?BH.w
828B 272E JREQ ?ELSE_0012
828D ?WHILE_0026:
; SOURCE LINE # 83
828D 5F CLRW X
828E C65240 LD A,05240H
8291 97 LD XL,A
8292 BF02 F LDW ?BH.w,X
8294 720F0004F4 F BTJF ?BL,#007H,?WHILE_0026
; SOURCE LINE # 84
8299 35D45241 MOV 05241H,#0D4H
829D ?WHILE_0027:
; SOURCE LINE # 85
829D 5F CLRW X
829E C65240 LD A,05240H
82A1 97 LD XL,A
82A2 BF02 F LDW ?BH.w,X
82A4 720F0004F4 F BTJF ?BL,#007H,?WHILE_0027
; SOURCE LINE # 86
82A9 354E5241 MOV 05241H,#04EH
; SOURCE LINE # 87
82AD A680 LD A,#080H
82AF C40000 F AND A,boot_flags
82B2 B703 F LD ?BH,A
82B4 5500030000 F MOV boot_flags,?BH
82B9 2055 JRA ?NXT_0024
82BB ?ELSE_0012:

82BB ?WHILE_0028:
; SOURCE LINE # 91
82BB 5F CLRW X
82BC C65240 LD A,05240H
82BF 97 LD XL,A
82C0 BF02 F LDW ?BH.w,X
82C2 720F0004F4 F BTJF ?BL,#007H,?WHILE_0028
; SOURCE LINE # 92
82C7 35D45241 MOV 05241H,#0D4H
82CB ?WHILE_0029:
; SOURCE LINE # 93
82CB 5F CLRW X
82CC C65240 LD A,05240H
82CF 97 LD XL,A
82D0 BF02 F LDW ?BH.w,X
82D2 720F0004F4 F BTJF ?BL,#007H,?WHILE_0029
; SOURCE LINE # 94
82D7 35595241 MOV 05241H,#059H
; SOURCE LINE # 95
82DB A680 LD A,#080H
82DD C40000 F AND A,boot_flags
82E0 B703 F LD ?BH,A
82E2 5500030000 F MOV boot_flags,?BH
; SOURCE LINE # 96
82E7 5F CLRW X
82E8 C60000 F LD A,number_of_blocks
82EB 97 LD XL,A
82EC 1CFFFF ADDW X,#0FFFFH
82EF 89 PUSHW X
82F0 5F CLRW X
82F1 C60000 F LD A,pack_number
82F4 97 LD XL,A
82F5 9085 POPW Y
82F7 90BF02 F LDW ?BH.w,Y
82FA B302 F CPW X,?BH.w
82FC 260E JRNE ?ELSE_0013
; SOURCE LINE # 97
82FE A67F LD A,#07FH
8300 C40000 F AND A,boot_flags
8303 B703 F LD ?BH,A
8305 5500030000 F MOV boot_flags,?BH
830A 2004 JRA ?NXT_0025
830C ?ELSE_0013:
; SOURCE LINE # 99
830C 725C0000 F INC pack_number
8310 ?NXT_0025:

8310 ?NXT_0024:
8310 2021 JRA ?NXT_0023
8312 ?ELSE_0011:

8312 ?WHILE_0030:
; SOURCE LINE # 104
8312 5F CLRW X
8313 C65240 LD A,05240H
8316 97 LD XL,A
8317 BF02 F LDW ?BH.w,X
8319 720F0004F4 F BTJF ?BL,#007H,?WHILE_0030
; SOURCE LINE # 105
831E 5500005241 F MOV 05241H,pack_number
8323 ?WHILE_0031:
; SOURCE LINE # 106
8323 5F CLRW X
8324 C65240 LD A,05240H
8327 97 LD XL,A
8328 BF02 F LDW ?BH.w,X
832A 720F0004F4 F BTJF ?BL,#007H,?WHILE_0031
; SOURCE LINE # 107
832F 35505241 MOV 05241H,#050H
8333 ?NXT_0023:
; SOURCE LINE # 109
8333 2000 JRA ?NXT_0018
8335 ?NXT_0018:

8335 ?NXT_0017:

8335 ?NXT_0014:
8335 CC0000 F JP ?WHILE_0016
8338 ?NXT_0013:
; SOURCE LINE # 114
8338 AC000000 F JPF main
833C ?EPILOG_0000:
833C 5B06 ADD SP,#006H
833E 87 RETF
; i unsigned char (size=1). Automatic variable in AUTO
; checksum unsigned char (size=1). Automatic variable in AUTO
; boot_block_erase_add unsigned long (size=4-Alg). Automatic variable in AUTO

; FUNCTION ?boot_process (END)

; FUNCTION ?program_device (BEGIN)
; SOURCE LINE # 118
0000 5205 SUB SP,#005H
0002 ?WHILE_0036:
; SOURCE LINE # 123
0002 5500000003 F MOV ?BH,boot_flags
0007 720C000303 F BTJT ?BH,#006H,?LAB_0029
000C CC0000 F JP ?NXT_0051
000F ?LAB_0029:
; SOURCE LINE # 125
000F 5500000003 F MOV ?BH,device_program_state
0014 B603 F LD A,?BH
0016 A100 CP A,#000H
0018 2734 JREQ ?CASE_0012
001A ?LAB_0020:
001A B603 F LD A,?BH
001C A101 CP A,#001H
001E 2603 JRNE ?LAB_0030
0020 CC0000 F JP ?CASE_0013
0023 ?LAB_0030:

0023 ?LAB_0021:
0023 B603 F LD A,?BH
0025 A102 CP A,#002H
0027 2603 JRNE ?LAB_0031
0029 CC0000 F JP ?CASE_0014
002C ?LAB_0031:

002C ?LAB_0022:
002C B603 F LD A,?BH
002E A104 CP A,#004H
0030 2603 JRNE ?LAB_0032
0032 CC0000 F JP ?CASE_0015
0035 ?LAB_0032:

0035 ?LAB_0023:
0035 B603 F LD A,?BH
0037 A108 CP A,#008H
0039 2603 JRNE ?LAB_0033
003B CC0000 F JP ?CASE_0016
003E ?LAB_0033:

003E ?LAB_0024:
003E 5F CLRW X
003F B603 F LD A,?BH
0041 5F CLRW X
0042 97 LD XL,A
0043 A30010 CPW X,#00010H
0046 2603 JRNE ?LAB_0019
0048 CC0000 F JP ?CASE_0017
004B ?LAB_0019:
004B CC0000 F JP ?NXT_0052
004E ?CASE_0012:
; SOURCE LINE # 128
004E 35A10000 F MOV flash_data_write_buf,#0A1H
; SOURCE LINE # 129
0052 35000000 F MOV flash_data_write_buf + 01H,#000H
; SOURCE LINE # 130
0056 35640000 F MOV flash_data_write_buf + 02H,#064H
; SOURCE LINE # 131
005A A600 LD A,#000H
005C 6B01 F LD (001H,SP),A ; [ i ]
005E ?FOR_0010:
; SOURCE LINE # 132
005E 5F CLRW X
005F 7B01 F LD A,(001H,SP) ; [ i ]
0061 97 LD XL,A
0062 1C0002 ADDW X,#00002H
0065 C60000 F LD A,flash_data_write_buf + 082H
0068 DB0000 F ADD A,(flash_data_write_buf + 00H,X)
006B B703 F LD ?BH,A
006D 5500030000 F MOV flash_data_write_buf + 082H,?BH
0072 ?NXT_0054:
; SOURCE LINE # 131
0072 7B01 F LD A,(001H,SP) ; [ i ]
0074 0C01 F INC (001H,SP) ; [ i ]
0076 5F CLRW X
0077 7B01 F LD A,(001H,SP) ; [ i ]
0079 97 LD XL,A
007A 89 PUSHW X
007B AE0081 LDW X,#00081H
007E 9085 POPW Y
0080 90BF02 F LDW ?BH.w,Y
0083 B302 F CPW X,?BH.w
0085 2CD7 JRSGT ?FOR_0010
0087 ?NXT_0053:
; SOURCE LINE # 133
0087 A600 LD A,#000H
0089 6B01 F LD (001H,SP),A ; [ i ]
008B ?FOR_0011:

008B ?WHILE_0037:
; SOURCE LINE # 135
008B 5F CLRW X
008C C65240 LD A,05240H
008F 97 LD XL,A
0090 BF02 F LDW ?BH.w,X
0092 720F0004F4 F BTJF ?BL,#007H,?WHILE_0037
; SOURCE LINE # 136
0097 5F CLRW X
0098 7B01 F LD A,(001H,SP) ; [ i ]
009A 97 LD XL,A
009B D60000 F LD A,(flash_data_write_buf + 00H,X)
009E C75241 LD 05241H,A
00A1 ?NXT_0056:
; SOURCE LINE # 133
00A1 7B01 F LD A,(001H,SP) ; [ i ]
00A3 0C01 F INC (001H,SP) ; [ i ]
00A5 5F CLRW X
00A6 7B01 F LD A,(001H,SP) ; [ i ]
00A8 97 LD XL,A
00A9 89 PUSHW X
00AA AE0083 LDW X,#00083H
00AD 9085 POPW Y
00AF 90BF02 F LDW ?BH.w,Y
00B2 B302 F CPW X,?BH.w
00B4 2CD5 JRSGT ?FOR_0011
00B6 ?NXT_0055:
; SOURCE LINE # 138
00B6 35010000 F MOV device_program_state,#001H
; SOURCE LINE # 139
00BA CC0000 F JP ?NXT_0052
00BD ?CASE_0013:
; SOURCE LINE # 141
00BD 5500000003 F MOV ?BH,local_flags1
00C2 7209000336 F BTJF ?BH,#004H,?NXT_0057
; SOURCE LINE # 143
00C7 A6EF LD A,#0EFH
00C9 C40000 F AND A,local_flags1
00CC B703 F LD ?BH,A
00CE 5500030000 F MOV local_flags1,?BH
; SOURCE LINE # 144
00D3 A664 LD A,#064H
00D5 C10000 F CP A,usart_rx_buf
00D8 2611 JRNE ?ELSE_0026
00DA A659 LD A,#059H
00DC C10000 F CP A,usart_rx_buf
00DF 260A JRNE ?ELSE_0026
00E1 ?LAB_0025:
; SOURCE LINE # 146
00E1 35020000 F MOV device_program_state,#002H
; SOURCE LINE # 147
00E5 35000000 F MOV boot_program_error_counter,#000H
00E9 2012 JRA ?NXT_0058
00EB ?ELSE_0026:
; SOURCE LINE # 151
00EB 725C0000 F INC boot_program_error_counter
; SOURCE LINE # 152
00EF A605 LD A,#005H
00F1 C10000 F CP A,boot_program_error_counter
00F4 2203 JRUGT ?ELSE_0027
; SOURCE LINE # 153
00F6 9D NOP
00F7 2004 JRA ?NXT_0059
00F9 ?ELSE_0027:
; SOURCE LINE # 155
00F9 35000000 F MOV device_program_state,#000H
00FD ?NXT_0059:

00FD ?NXT_0058:

00FD ?NXT_0057:
; SOURCE LINE # 158
00FD CC0000 F JP ?NXT_0052
0100 ?CASE_0014:
; SOURCE LINE # 160
0100 35B20000 F MOV flash_data_write_buf,#0B2H
; SOURCE LINE # 161
0104 35000000 F MOV flash_data_write_buf + 01H,#000H
; SOURCE LINE # 162
0108 35E50000 F MOV flash_data_write_buf + 02H,#0E5H
; SOURCE LINE # 163
010C A600 LD A,#000H
010E 6B01 F LD (001H,SP),A ; [ i ]
0110 ?FOR_0012:
; SOURCE LINE # 164
0110 5F CLRW X
0111 7B01 F LD A,(001H,SP) ; [ i ]
0113 97 LD XL,A
0114 1C0002 ADDW X,#00002H
0117 C60000 F LD A,flash_data_write_buf + 082H
011A DB0000 F ADD A,(flash_data_write_buf + 00H,X)
011D B703 F LD ?BH,A
011F 5500030000 F MOV flash_data_write_buf + 082H,?BH
0124 ?NXT_0061:
; SOURCE LINE # 163
0124 7B01 F LD A,(001H,SP) ; [ i ]
0126 0C01 F INC (001H,SP) ; [ i ]
0128 5F CLRW X
0129 7B01 F LD A,(001H,SP) ; [ i ]
012B 97 LD XL,A
012C 89 PUSHW X
012D AE0081 LDW X,#00081H
0130 9085 POPW Y
0132 90BF02 F LDW ?BH.w,Y
0135 B302 F CPW X,?BH.w
0137 2CD7 JRSGT ?FOR_0012
0139 ?NXT_0060:
; SOURCE LINE # 165
0139 A600 LD A,#000H
013B 6B01 F LD (001H,SP),A ; [ i ]
013D ?FOR_0013:

013D ?WHILE_0038:
; SOURCE LINE # 167
013D 5F CLRW X
013E C65240 LD A,05240H
0141 97 LD XL,A
0142 BF02 F LDW ?BH.w,X
0144 720F0004F4 F BTJF ?BL,#007H,?WHILE_0038
; SOURCE LINE # 168
0149 5F CLRW X
014A 7B01 F LD A,(001H,SP) ; [ i ]
014C 97 LD XL,A
014D D60000 F LD A,(flash_data_write_buf + 00H,X)
0150 C75241 LD 05241H,A
0153 ?NXT_0063:
; SOURCE LINE # 165
0153 7B01 F LD A,(001H,SP) ; [ i ]
0155 0C01 F INC (001H,SP) ; [ i ]
0157 5F CLRW X
0158 7B01 F LD A,(001H,SP) ; [ i ]
015A 97 LD XL,A
015B 89 PUSHW X
015C AE0083 LDW X,#00083H
015F 9085 POPW Y
0161 90BF02 F LDW ?BH.w,Y
0164 B302 F CPW X,?BH.w
0166 2CD5 JRSGT ?FOR_0013
0168 ?NXT_0062:
; SOURCE LINE # 170
0168 35040000 F MOV device_program_state,#004H
; SOURCE LINE # 171
016C CC0000 F JP ?NXT_0052
016F ?CASE_0015:
; SOURCE LINE # 173
016F 5500000003 F MOV ?BH,local_flags1
0174 720900034F F BTJF ?BH,#004H,?NXT_0064
; SOURCE LINE # 175
0179 A6EF LD A,#0EFH
017B C40000 F AND A,local_flags1
017E B703 F LD ?BH,A
0180 5500030000 F MOV local_flags1,?BH
; SOURCE LINE # 176
0185 5F CLRW X
0186 C60000 F LD A,usart_rx_buf
0189 97 LD XL,A
018A 89 PUSHW X
018B AE00E5 LDW X,#000E5H
018E 9085 POPW Y
0190 90BF02 F LDW ?BH.w,Y
0193 B302 F CPW X,?BH.w
0195 261F JRNE ?ELSE_0029
0197 A659 LD A,#059H
0199 C10000 F CP A,usart_rx_buf + 01H
019C 2618 JRNE ?ELSE_0029
019E ?LAB_0026:
; SOURCE LINE # 178
019E 35080000 F MOV device_program_state,#008H
; SOURCE LINE # 179
01A2 AE0000 LDW X,#00000H
01A5 1F02 F LDW (002H,SP),X ; [ flash_add ]
01A7 AE9000 LDW X,#09000H
01AA 1F04 F LDW (004H,SP),X ; [ flash_add + 02H ]
; SOURCE LINE # 180
01AC 35000000 F MOV boot_program_error_counter,#000H
; SOURCE LINE # 181
01B0 35000000 F MOV pack_number,#000H
01B4 2012 JRA ?NXT_0065
01B6 ?ELSE_0029:
; SOURCE LINE # 185
01B6 725C0000 F INC boot_program_error_counter
; SOURCE LINE # 186
01BA A605 LD A,#005H
01BC C10000 F CP A,boot_program_error_counter
01BF 2203 JRUGT ?ELSE_0030
; SOURCE LINE # 187
01C1 9D NOP
01C2 2004 JRA ?NXT_0066
01C4 ?ELSE_0030:
; SOURCE LINE # 189
01C4 35020000 F MOV device_program_state,#002H
01C8 ?NXT_0066:

01C8 ?NXT_0065:

01C8 ?NXT_0064:
; SOURCE LINE # 192
01C8 CC0000 F JP ?NXT_0052
01CB ?CASE_0016:
; SOURCE LINE # 194
01CB 35D40000 F MOV flash_data_write_buf,#0D4H
; SOURCE LINE # 195
01CF 5500000000 F MOV flash_data_write_buf + 01H,pack_number
; SOURCE LINE # 196
01D4 A600 LD A,#000H
01D6 6B01 F LD (001H,SP),A ; [ i ]
01D8 ?FOR_0014:
; SOURCE LINE # 198
01D8 1E04 F LDW X,(004H,SP) ; [ flash_add + 02H ]
01DA BF02 F LDW ?BH.w,X
01DC 5F CLRW X
01DD 7B01 F LD A,(001H,SP) ; [ i ]
01DF 97 LD XL,A
01E0 92D600 F LD A,([?BH.w],X)
01E3 C70000 F LD flash_data_write_buf + 02H,A
; SOURCE LINE # 199
01E6 1E04 F LDW X,(004H,SP) ; [ flash_add + 02H ]
01E8 BF02 F LDW ?BH.w,X
01EA 5F CLRW X
01EB 7B01 F LD A,(001H,SP) ; [ i ]
01ED 97 LD XL,A
01EE C60000 F LD A,flash_data_write_buf + 082H
01F1 92DB00 F ADD A,([?BH.w],X)
01F4 B703 F LD ?BH,A
01F6 5500030000 F MOV flash_data_write_buf + 082H,?BH
01FB ?NXT_0068:
; SOURCE LINE # 196
01FB 7B01 F LD A,(001H,SP) ; [ i ]
01FD 0C01 F INC (001H,SP) ; [ i ]
01FF 5F CLRW X
0200 7B01 F LD A,(001H,SP) ; [ i ]
0202 97 LD XL,A
0203 89 PUSHW X
0204 AE0080 LDW X,#00080H
0207 9085 POPW Y
0209 90BF02 F LDW ?BH.w,Y
020C B302 F CPW X,?BH.w
020E 2CC8 JRSGT ?FOR_0014
0210 ?NXT_0067:
; SOURCE LINE # 201
0210 A600 LD A,#000H
0212 6B01 F LD (001H,SP),A ; [ i ]
0214 ?FOR_0015:

0214 ?WHILE_0039:
; SOURCE LINE # 203
0214 5F CLRW X
0215 C65240 LD A,05240H
0218 97 LD XL,A
0219 BF02 F LDW ?BH.w,X
021B 720F0004F4 F BTJF ?BL,#007H,?WHILE_0039
; SOURCE LINE # 204
0220 5F CLRW X
0221 7B01 F LD A,(001H,SP) ; [ i ]
0223 97 LD XL,A
0224 D60000 F LD A,(flash_data_write_buf + 00H,X)
0227 C75241 LD 05241H,A
022A ?NXT_0070:
; SOURCE LINE # 201
022A 7B01 F LD A,(001H,SP) ; [ i ]
022C 0C01 F INC (001H,SP) ; [ i ]
022E 5F CLRW X
022F 7B01 F LD A,(001H,SP) ; [ i ]
0231 97 LD XL,A
0232 89 PUSHW X
0233 AE0083 LDW X,#00083H
0236 9085 POPW Y
0238 90BF02 F LDW ?BH.w,Y
023B B302 F CPW X,?BH.w
023D 2CD5 JRSGT ?FOR_0015
023F ?NXT_0069:
; SOURCE LINE # 206
023F 35100000 F MOV device_program_state,#010H
; SOURCE LINE # 207
0243 CC0000 F JP ?NXT_0052
0246 ?CASE_0017:
; SOURCE LINE # 209
0246 5500000003 F MOV ?BH,local_flags1
024B 7208000303 F BTJT ?BH,#004H,?LAB_0034
0250 CC0000 F JP ?NXT_0071
0253 ?LAB_0034:
; SOURCE LINE # 211
0253 A6EF LD A,#0EFH
0255 C40000 F AND A,local_flags1
0258 B703 F LD ?BH,A
025A 5500030000 F MOV local_flags1,?BH
; SOURCE LINE # 212
025F 5F CLRW X
0260 C60000 F LD A,usart_rx_buf
0263 97 LD XL,A
0264 89 PUSHW X
0265 AE00D4 LDW X,#000D4H
0268 9085 POPW Y
026A 90BF02 F LDW ?BH.w,Y
026D B302 F CPW X,?BH.w
026F 264F JRNE ?ELSE_0032
0271 A659 LD A,#059H
0273 C10000 F CP A,usart_rx_buf + 01H
0276 2648 JRNE ?ELSE_0032
0278 ?LAB_0027:
; SOURCE LINE # 214
0278 5F CLRW X
0279 C60000 F LD A,number_of_blocks
027C 97 LD XL,A
027D 1CFFFF ADDW X,#0FFFFH
0280 89 PUSHW X
0281 5F CLRW X
0282 C60000 F LD A,pack_number
0285 97 LD XL,A
0286 9085 POPW Y
0288 90BF02 F LDW ?BH.w,Y
028B B302 F CPW X,?BH.w
028D 260E JRNE ?ELSE_0033
; SOURCE LINE # 215
028F A6BF LD A,#0BFH
0291 C40000 F AND A,boot_flags
0294 B703 F LD ?BH,A
0296 5500030000 F MOV boot_flags,?BH
029B 2021 JRA ?NXT_0073
029D ?ELSE_0033:
; SOURCE LINE # 218
029D 1E04 F LDW X,(004H,SP) ; [ flash_add + 02H ]
029F 89 PUSHW X
02A0 1E04 F LDW X,(004H,SP) ; [ flash_add ]
02A2 89 PUSHW X
02A3 8D000000 F DNF M(05) CALLF ?C?mv4_pg2bc1
02A7 ?DATASTART_0001:
02A7 80 M DB 080H
02A8 ?DATAEND_0001:
02A8 8D000000 F DNF CALLF ?C?add3232
02AC A601 F LD A,#001H
02AE 8D000000 F CALLF ?C?mv4_bc2isa
; SOURCE LINE # 219
02B2 35080000 F MOV device_program_state,#008H
; SOURCE LINE # 220
02B6 35000000 F MOV boot_program_error_counter,#000H
; SOURCE LINE # 221
02BA 725C0000 F INC pack_number
02BE ?NXT_0073:
02BE 203F JRA ?NXT_0072
02C0 ?ELSE_0032:
; SOURCE LINE # 226
02C0 725C0000 F INC boot_program_error_counter
; SOURCE LINE # 227
02C4 A605 LD A,#005H
02C6 C10000 F CP A,boot_program_error_counter
02C9 2203 JRUGT ?ELSE_0034
; SOURCE LINE # 228
02CB 9D NOP
02CC 2031 JRA ?NXT_0074
02CE ?ELSE_0034:
; SOURCE LINE # 231
02CE A650 LD A,#050H
02D0 C10000 F CP A,usart_rx_buf + 01H
02D3 2626 JRNE ?NXT_0075
02D5 C60000 F LD A,usart_rx_buf
02D8 C10000 F CP A,pack_number
02DB 241E JRUGE ?NXT_0075
02DD ?LAB_0028:
; SOURCE LINE # 233
02DD 5500000000 F MOV pack_number,usart_rx_buf
; SOURCE LINE # 234
02E2 905F CLRW Y
02E4 C60000 F LD A,pack_number
02E7 9097 LD YL,A
02E9 93 LDW X,Y
02EA A680 LD A,#080H
02EC 42 MUL X,A
02ED 1C9000 ADDW X,#09000H
02F0 BF05 F LDW ?CH,X
02F2 5F CLRW X
02F3 BF03 F LDW ?BH,X
02F5 A601 F LD A,#001H
02F7 8D000000 F CALLF ?C?mv4_bc2isa
02FB ?NXT_0075:
; SOURCE LINE # 236
02FB 35080000 F MOV device_program_state,#008H
02FF ?NXT_0074:

02FF ?NXT_0072:

02FF ?NXT_0071:

02FF ?NXT_0052:
02FF CC0000 F JP ?WHILE_0036
0302 ?NXT_0051:

0302 ?EPILOG_0001:
0302 5B05 ADD SP,#005H
0304 87 RETF
; i unsigned char (size=1). Automatic variable in AUTO
; flash_add unsigned long (size=4-Alg). Automatic variable in AUTO

; FUNCTION ?program_device (END)

RCSTM8 COMPILER V2.24.09.238

MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 1476 ----
CONSTANT SIZE = ---- ----
DATA SIZE = ---- ----
PAGE0 SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.

RCSTM8 COMPILATION COMPLETE. 0 WARNING, 0 ERROR

thanks
Igal

+1
0
-1
October 21, 2009 - 10:56am
Guest

I think I found the problem.
I'm using the buffer in a procedure which runs from the RAM.

this is the proc.

void copy_flash(u32 dest, u8 length) inram
{
u8 Count;

for (Count = 0; Count < length; Count++)
{
*((u8*)dest + Count) = flash_data_write_buf[FLASH_WR_BUF_STR_DATA+Count];
}
}

when I write "*((u8*)dest + Count) = 3;" instead the project compiles, but this procedure must run from RAM so I'm looking for a solution, any help will be appreciated.

thanks
Igal

+1
0
-1
October 22, 2009 - 6:18pm
Raisonance Support Team

Hi Igal,

Thanks a lot for helping on this issue.

We found the problem: It is caused by inram functions that leave some incorrect fixup information for CodeCompressor, which break the linker.

There is no simple workaround for this problem.

The next RKit-STM8 release will fix this, and it should be out within 2 weeks.

If you cannot wait until then we can send you an engineering (unsupported) version that fixes the problem, but this should not be your preferred option as it is not validated yetand may cause other issues.

Regards,
BRuno

+1
0
-1
October 26, 2009 - 8:14am
Guest

Hi Bruno

I guess we'll wait for the next version

Thanks
Igal