リストア時、バックアップが壊れていないかチェックする際、見に行くアドレスを間違えていた

git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-05-23%20-%20ctr.7z%20+%20svn_v1.068.zip/ctr/svn/ctr_mcu@230 013db118-44a6-b54f-8bf7-843cb86687b1
This commit is contained in:
N2232 2010-09-09 08:09:11 +00:00
parent ca89291e93
commit 6cd4289b4b
8 changed files with 95 additions and 48 deletions

View File

@ -1,7 +1,7 @@
#ifndef __config__
#define __config__
//#define _debug_led_
#define _debug_led_
//#define _ALLOW_NOBATT_
//#define _DEBUG_BT_FUEL_
//#define _DEBUG_BT_TEMP_

View File

@ -78,7 +78,7 @@ void main( )
// 通常の電源投入
u8 pwup_delay0 = 0;
u8 pwup_delay1 = 0;
do
{ // 電池接続時、16ms待ってみる(チャタリング対策)
pwup_delay0 += 1;
@ -91,11 +91,41 @@ void main( )
while( pwup_delay0 != 0 );
}
// ファームの整合性チェック //
{
#if 0
u8 i;
u8 comp = 0;
u8 comp2 = 0;
u8 comp3 = 0;
u8 temp;
// ローダーと本体は同じバージョンか?
/// 次へのアップデートの途中で終わってないか?
for( i = 0; i < sizeof( __TIME__ ); i++ ) // sizeof( __TIME__ ) = 8 らし
{
comp += ( *( __far u8 * )( MGC_LOAD + i ) == *( u8 * )( MGC_FOOT + i ) ) ? 0 : 1;
comp2 += ( *( u8 * )( MGC_HEAD + i ) == *( u8 * )( MGC_FOOT + i ) ) ? 0 : 1;
}
if( *( u8 * )( MGC_FOOT ) == 0xFF ) // 消去済のまま
{
comp3 += 1;
}
if(! ( (comp == 0) && (comp2 == 0) && (comp3 == 0) ))
{
hdwinit2( );
// ファームリストアを試みる
temp = ( ((comp == 0)? 0:1 ) + ((comp2 == 0)? 0:2 ) + ((comp3 == 0)? 0:4 ) );
firm_restore( temp );
// 帰ってこない。リセットをかける。
}
#else
u8 i;
u8 comp = 0;
u8 temp;
// ローダーと本体は同じバージョンか?
/// 次へのアップデートの途中で終わってないか?
@ -110,13 +140,14 @@ void main( )
comp += 1;
}
if( comp != 0 )
if(! ( (comp == 0) ))
{
hdwinit2( );
// ファームリストアを試みる
firm_restore( );
// 帰ってこない。リセットをかける。
}
#endif
}
WDT_Restart( );
@ -146,7 +177,7 @@ void main( )
*/
hdwinit2( );
}
// 通常運転
main_loop( );
}

View File

@ -243,6 +243,7 @@ void firm_update( )
======================================================== */
void firm_restore( )
{
DBG_LED_on;
PM1.5 = 0;
// バックアップは正常? //
@ -252,7 +253,7 @@ void firm_restore( )
for( i = 0; i < sizeof( __TIME__ ); i++ ) // sizeof( __TIME__ ) = 8 らし
{
comp += ( *( __far u8 * )( MGC_LOAD_BKUP + i ) == *( u8 * )( MGC_HEAD_BKUP + i ) ) ? 0 : 1;
comp += ( *( __far u8 * )( MGC_LOAD + i ) == *( u8 * )( MGC_HEAD_BKUP + i ) ) ? 0 : 1;
comp += ( *( u8 * )( MGC_HEAD_BKUP + i ) == *( u8 * )( MGC_FOOT_BKUP + i ) ) ? 0 : 1;
}
if( *( u8 * )( MGC_FOOT_BKUP ) == 0xFF )
@ -352,15 +353,18 @@ void firm_restore( )
{
alert(2);
}
DBG_LED_off;
// todo
//  リストア失敗したら、LEDちかちかとかさせて、サービス送りにしてもらう
// リブート
/*
// リブート
if( FSL_InvertBootFlag() != ERR_SUCCESS )
{
alert(3);
}
*/
FSL_ForceReset(); // リセット
// FSL_SwapBootCluster( ); // ブートスワップ「せずに」再起動って出来ないらしい
}

View File

@ -1,20 +1,43 @@
C:\WINDOWS\system32\cmd.exe /c touch magic.c
"C:\Program Files\NEC Electronics Tools\CC78K0R\W2.10\bin\cc78k0r.exe" -c9F0104 -y"C:\Program Files\NEC Electronics Tools\DEV" -_msgoff -irenge -i"C:\Program Files\NEC Electronics Tools\FSL78K0R_Type02ES\V1.20\inc78k0r" -ms -qvjl2w -sainter_asm -zpb -no loader.c
loader.c(134) : CC78K0R warning W0401: Conversion may lose significant digits
loader.c(135) : CC78K0R warning W0401: Conversion may lose significant digits
Compilation complete, 0 error(s) and 2 warning(s) found.
"C:\Program Files\NEC Electronics Tools\RA78K0R\W1.31\bin\ra78k0r.exe" -c9F0104 -y"C:\Program Files\NEC Electronics Tools\DEV" -_msgoff inter_asm\loader.asm
Assembly complete, 0 error(s) and 0 warning(s) found.
"C:\Program Files\NEC Electronics Tools\CC78K0R\W2.10\bin\cc78k0r.exe" -c9F0104 -y"C:\Program Files\NEC Electronics Tools\DEV" -_msgoff -irenge -i"C:\Program Files\NEC Electronics Tools\FSL78K0R_Type02ES\V1.20\inc78k0r" -ms -qvjl2w -sainter_asm -zpb -no main.c
Compilation complete, 0 error(s) and 0 warning(s) found.
"C:\Program Files\NEC Electronics Tools\RA78K0R\W1.31\bin\ra78k0r.exe" -c9F0104 -y"C:\Program Files\NEC Electronics Tools\DEV" -_msgoff inter_asm\main.asm
Assembly complete, 0 error(s) and 0 warning(s) found.
"C:\Program Files\NEC Electronics Tools\CC78K0R\W2.10\bin\cc78k0r.exe" -c9F0104 -y"C:\Program Files\NEC Electronics Tools\DEV" -_msgoff -irenge -i"C:\Program Files\NEC Electronics Tools\FSL78K0R_Type02ES\V1.20\inc78k0r" -ms -qvjl2w -sainter_asm -zpb -no magic.c
Compilation complete, 0 error(s) and 0 warning(s) found.
"C:\Program Files\NEC Electronics Tools\RA78K0R\W1.31\bin\ra78k0r.exe" -c9F0104 -y"C:\Program Files\NEC Electronics Tools\DEV" -_msgoff inter_asm\magic.asm
Assembly complete, 0 error(s) and 0 warning(s) found.
"C:\Program Files\NEC Electronics Tools\CC78K0R\W2.10\bin\cc78k0r.exe" -c9F0104 -y"C:\Program Files\NEC Electronics Tools\DEV" -_msgoff -irenge -i"C:\Program Files\NEC Electronics Tools\FSL78K0R_Type02ES\V1.20\inc78k0r" -ms -qvjl2w -sainter_asm -zpb -no led.c
led.c(108) : CC78K0R warning W0745: Expected function prototype
led.c(246) : CC78K0R warning W0401: Conversion may lose significant digits
led.c(251) : CC78K0R warning W0401: Conversion may lose significant digits
led.c(313) : CC78K0R warning W0401: Conversion may lose significant digits
led.c(372) : CC78K0R warning W0401: Conversion may lose significant digits
led.c(398) : CC78K0R warning W0401: Conversion may lose significant digits
led.c(574) : CC78K0R warning W0401: Conversion may lose significant digits
Compilation complete, 0 error(s) and 7 warning(s) found.
"C:\Program Files\NEC Electronics Tools\RA78K0R\W1.31\bin\ra78k0r.exe" -c9F0104 -y"C:\Program Files\NEC Electronics Tools\DEV" -_msgoff inter_asm\led.asm
"C:\Program Files\NEC Electronics Tools\CC78K0R\W2.10\bin\cc78k0r.exe" -c9F0104 -y"C:\Program Files\NEC Electronics Tools\DEV" -_msgoff -irenge -i"C:\Program Files\NEC Electronics Tools\FSL78K0R_Type02ES\V1.20\inc78k0r" -ms -qvjl2w -sainter_asm -zpb -no WDT.c
Compilation complete, 0 error(s) and 0 warning(s) found.
"C:\Program Files\NEC Electronics Tools\RA78K0R\W1.31\bin\ra78k0r.exe" -c9F0104 -y"C:\Program Files\NEC Electronics Tools\DEV" -_msgoff inter_asm\WDT.asm
Assembly complete, 0 error(s) and 0 warning(s) found.
"C:\Program Files\NEC Electronics Tools\RA78K0R\W1.31\bin\lk78k0r.exe" -y"C:\Program Files\NEC Electronics Tools\DEV" -_msgoff -obsr.lmf "..\..\..\Program Files\NEC Electronics Tools\CC78K0R\W2.10\lib78k0r\s0rm.rel" -go85h,0FC00h,1024 -gi1B339499E033F240BFAAh -pbsr_k0r.map -nkd -gb0FEFBFFh -b"C:\Program Files\NEC Electronics Tools\FSL78K0R_Type02ES\V1.20\lib78k0r\fsl.lib" -bcl0rdm.lib -bcl0rm.lib -bcl0rmf.lib -i"C:\Program Files\NEC Electronics Tools\CC78K0R\W2.10\lib78k0r" -dbsr_mcu.dr -s -w0 loader.rel pm.rel i2c_ctr.rel main.rel magic.rel WDT.rel i2c_mcu.rel i2c_twl.rel led.rel rtc.rel vreg_ctr.rel vreg_twl.rel adc.rel renge.rel accero.rel self_flash.rel sw.rel task_debug.rel task_misc.rel task_sys.rel pedo_alg_thre_det2.rel ini_VECT.rel task_status.rel
"C:\Program Files\NEC Electronics Tools\CC78K0R\W2.10\bin\cc78k0r.exe" -c9F0104 -y"C:\Program Files\NEC Electronics Tools\DEV" -_msgoff -irenge -i"C:\Program Files\NEC Electronics Tools\FSL78K0R_Type02ES\V1.20\inc78k0r" -ms -qvjl2w -sainter_asm -zpb -no i2c_mcu.c
i2c_mcu.c(205) : CC78K0R warning W0401: Conversion may lose significant digits
Compilation complete, 0 error(s) and 1 warning(s) found.
"C:\Program Files\NEC Electronics Tools\RA78K0R\W1.31\bin\ra78k0r.exe" -c9F0104 -y"C:\Program Files\NEC Electronics Tools\DEV" -_msgoff inter_asm\i2c_mcu.asm
Assembly complete, 0 error(s) and 0 warning(s) found.
"C:\Program Files\NEC Electronics Tools\CC78K0R\W2.10\bin\cc78k0r.exe" -c9F0104 -y"C:\Program Files\NEC Electronics Tools\DEV" -_msgoff -irenge -i"C:\Program Files\NEC Electronics Tools\FSL78K0R_Type02ES\V1.20\inc78k0r" -ms -qvjl2w -sainter_asm -zpb -no self_flash.c
self_flash.c(214) : CC78K0R warning W0401: Conversion may lose significant digits
self_flash.c(256) : CC78K0R warning W0401: Conversion may lose significant digits
self_flash.c(257) : CC78K0R warning W0401: Conversion may lose significant digits
Compilation complete, 0 error(s) and 3 warning(s) found.
"C:\Program Files\NEC Electronics Tools\RA78K0R\W1.31\bin\ra78k0r.exe" -c9F0104 -y"C:\Program Files\NEC Electronics Tools\DEV" -_msgoff inter_asm\self_flash.asm
Assembly complete, 0 error(s) and 0 warning(s) found.
"C:\Program Files\NEC Electronics Tools\CC78K0R\W2.10\bin\cc78k0r.exe" -c9F0104 -y"C:\Program Files\NEC Electronics Tools\DEV" -_msgoff -irenge -i"C:\Program Files\NEC Electronics Tools\FSL78K0R_Type02ES\V1.20\inc78k0r" -ms -qvjl2w -sainter_asm -zpb -no task_debug.c
Compilation complete, 0 error(s) and 0 warning(s) found.
"C:\Program Files\NEC Electronics Tools\RA78K0R\W1.31\bin\ra78k0r.exe" -c9F0104 -y"C:\Program Files\NEC Electronics Tools\DEV" -_msgoff inter_asm\task_debug.asm
Assembly complete, 0 error(s) and 0 warning(s) found.
"C:\Program Files\NEC Electronics Tools\CC78K0R\W2.10\bin\cc78k0r.exe" -c9F0104 -y"C:\Program Files\NEC Electronics Tools\DEV" -_msgoff -irenge -i"C:\Program Files\NEC Electronics Tools\FSL78K0R_Type02ES\V1.20\inc78k0r" -ms -qvjl2w -sainter_asm -zpb -no task_status.c
Compilation complete, 0 error(s) and 0 warning(s) found.
"C:\Program Files\NEC Electronics Tools\RA78K0R\W1.31\bin\ra78k0r.exe" -c9F0104 -y"C:\Program Files\NEC Electronics Tools\DEV" -_msgoff inter_asm\task_status.asm
Assembly complete, 0 error(s) and 0 warning(s) found.
"C:\Program Files\NEC Electronics Tools\RA78K0R\W1.31\bin\lk78k0r.exe" -y"C:\Program Files\NEC Electronics Tools\DEV" -_msgoff -obsr.lmf "..\..\..\Program Files\NEC Electronics Tools\CC78K0R\W2.10\lib78k0r\s0rm.rel" -gi1B339499E033F240BFAAh -pbsr_k0r.map -nkd -gb0FEFBFFh -b"C:\Program Files\NEC Electronics Tools\FSL78K0R_Type02ES\V1.20\lib78k0r\fsl.lib" -bcl0rdm.lib -bcl0rm.lib -bcl0rmf.lib -i"C:\Program Files\NEC Electronics Tools\CC78K0R\W2.10\lib78k0r" -dbsr_mcu.dr -s -w0 loader.rel pm.rel i2c_ctr.rel main.rel magic.rel WDT.rel i2c_mcu.rel i2c_twl.rel led.rel rtc.rel vreg_ctr.rel vreg_twl.rel adc.rel renge.rel accero.rel self_flash.rel sw.rel task_debug.rel task_misc.rel task_sys.rel pedo_alg_thre_det2.rel ini_VECT.rel task_status.rel
Link complete, 0 error(s) and 0 warning(s) found.
"C:\Program Files\NEC Electronics Tools\RA78K0R\W1.31\bin\oc78k0r.exe" -y"C:\Program Files\NEC Electronics Tools\DEV" -_msgoff -o.\bsr.hex -nu -ki bsr.lmf
Object Conversion Complete, 0 error(s) and 0 warning(s) found.
@ -24,4 +47,4 @@ intel-HEX to bsr bin converter
file converted!
Build Total error(s) : 0 Total warning(s) : 7
Build Total error(s) : 0 Total warning(s) : 6

View File

@ -50,7 +50,7 @@ LoadFilter1=5
Offset1=0
Object1=ON
Symbol1=ON
Erase1=ON
Erase1=OFF
HighSpeed1=OFF
CPU Reset1=ON
Symbol Reset1=ON
@ -81,7 +81,7 @@ Kanji=SJIS
Geometry=471, 106, 877, 1043
Window=Normal
DispStart=17
CaretPos=78,0
CaretPos=75,0
Mode=Normal
DispFile=
Address1=
@ -139,19 +139,11 @@ SaveRange=Screen
SaveStart=
SaveEnd=
Accumulative=ON
[Source1]
Geometry=66, 20, 877, 884
Window=Normal
DispStart=40
CaretPos=48,21
Mode=Normal
DispFile=task_sys.c
Accumulative=ON
[Assemble]
Geometry=14, 194, 968, 626
Window=Hide
DispStart=864531456
CaretPos=0,0
Geometry=124, 418, 968, 626
Window=Normal
DispStart=768
CaretPos=768,27
Address1=
Address2=
Address3=
@ -975,7 +967,7 @@ Boundary=18088086
4=.P4.2,P,S,A,+,1
5=.PM1.5,P,S,A,+,1
6=.P1.5,P,S,A,+,1
7=+system_status,.,N,A,-,1
7=.system_status,.,N,A,+,1
8=.info_LED,.,N,A,+,1
9=.time_to_next_frame,P,N,A,+,1
Line=10
@ -1000,11 +992,7 @@ Line=10
Geometry=709, 826, 445, 260
Window=Normal
Width=150 30 200 100
Name0=Swb00007
Address0=task_sys.c#_tsk_sys+0x5a
Window0=ASM
Status0=ON
Count=1
Count=0
[Reset]
Debugger=ON
Symbol=OFF

View File

@ -838,7 +838,7 @@ G=1
E=0
E0=flash.elk
E1=a.elk
GO=1
GO=0
GOValue=85
GOStart=FC00
GOSizeValue=1024

View File

@ -9,8 +9,9 @@ OpenFile2=ProjectWindow
PrjPos=0,2,754,3,253
OpenFile3=led.c,0,504,84,1559,996,20,560,31,0
OpenFile4=pm.h,0,198,198,1442,924,24,139,24,0
OpenFile5=config.h,0,154,154,1398,880,2,4,0,0
OpenFile6=OutputWindow
OpenFile5=loader.c,0,176,176,1420,902,9,92,9,0
OpenFile6=config.h,0,154,154,1398,880,29,17,29,0
OpenFile7=OutputWindow
OutputPos=0,491,1000,330,1535
ActivePRJ=yav_mcu_bsr.prj
[ProjectWindow]

View File

@ -1,7 +1,7 @@
[SdbInfo]
Ver=5
[loader.c]
T=4c59543c
T=4c887fd9
1=incs_loader.h
2=..\..\..\Program Files\NEC Electronics Tools\FSL78K0R_Type02ES\V1.20\inc78k0r\fsl.h
3=fsl_user.h
@ -36,7 +36,7 @@ T=4c5a5ef2
7=adc.h
8=pool.h
[magic.c]
T=4c871597
T=4c8886a1
1=config.h
[WDT.c]
T=4bf0d1e1
@ -56,7 +56,7 @@ T=4c871cec
1=incs.h
2=led.h
[rtc.c]
T=4c6a678e
T=4c883032
1=incs.h
[vreg_ctr.c]
T=4c7c53de
@ -98,7 +98,7 @@ T=4c525844
2=incs.h
3=..\..\..\Program Files\NEC Electronics Tools\CC78K0R\W2.10\inc78k0r\math.h
[self_flash.c]
T=4c59540f
T=4c8886fc
1=incs_loader.h
2=..\..\..\Program Files\NEC Electronics Tools\FSL78K0R_Type02ES\V1.20\inc78k0r\fsl.h
3=fsl_user.h
@ -162,7 +162,7 @@ T=4c4fe85a
5=adc.h
6=i2c_mcu.h
[incs_loader.h]
T=4c119cde
T=4c887efa
1=jhl_defs.h
2=user_define.h
3=bsr_system.h
@ -176,7 +176,7 @@ T=4c119cde
T=4c075832
1=config.h
[config.h]
T=4c871322
T=4c88835b
[user_define.h]
T=4c84442a
[bsr_system.h]