一応ビルドはできるようになった。

レジスタを全部変数に宣言してあるだけ
ペリフェラルのレジスタ操作も正しくない
K0Rでもビルドできた。(正しいかは未検証)

git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-05-23%20-%20ctr.7z%20+%20svn_v1.068.zip/ctr/svn/ctr_mcu@484 013db118-44a6-b54f-8bf7-843cb86687b1
This commit is contained in:
n2232 2012-10-29 04:35:35 +00:00
parent 53eb60f4a2
commit a44e696248
36 changed files with 203 additions and 172 deletions

View File

@ -6,7 +6,7 @@
$Id: accero.c 418 2011-09-22 01:35:37Z n2232 $ $Id: accero.c 418 2011-09-22 01:35:37Z n2232 $
======================================================== */ ======================================================== */
#ifndef _WIN32 #ifdef _78K0R
#pragma SFR #pragma SFR
#pragma NOP #pragma NOP
@ -19,7 +19,7 @@
#endif #endif
#ifndef _WIN32 #ifdef _78K0R
#pragma interrupt INTP23 intp23_ACC_ready RB3 // 加速度センサ、データ準備完了 #pragma interrupt INTP23 intp23_ACC_ready RB3 // 加速度センサ、データ準備完了
@ -30,7 +30,7 @@
#include "i2c_mcu.h" #include "i2c_mcu.h"
#ifndef _WIN32 #ifdef _78K0R
#include <math.h> #include <math.h>
#endif #endif
// ======================================================== // ========================================================

View File

@ -24,7 +24,7 @@ const bt_param_ bt_param[ _BT_PARAM_NUM_ ] =
0x1C, 0x60, 0x12, 0x00, 0x12, 0x00, 0x12, 0x00 0x1C, 0x60, 0x12, 0x00, 0x12, 0x00, 0x12, 0x00
}, },
2, // 2 = 19 bit mode 2, // 2 = 19 bit mode
{ 92, (u8)(-256* 0.79), (u8)(-256* 4.35) }, //  (u8)誤キャストの誤パラメータのままの方が { 92, /*(u8)*/(-256* 0.79), /*(u8)*/(-256* 4.35) }, //  (u8)誤キャストの誤パラメータのままの方が
0xD800, // システムとしては良好な動作 0xD800, // システムとしては良好な動作
{ 0xEA, 0xE8 } { 0xEA, 0xE8 }
}, },
@ -42,7 +42,7 @@ const bt_param_ bt_param[ _BT_PARAM_NUM_ ] =
0x07, 0x00, 0x09, 0x30, 0x01, 0xC0, 0x01, 0xC0 0x07, 0x00, 0x09, 0x30, 0x01, 0xC0, 0x01, 0xC0
}, },
1, 1,
{ 171, (u8)(-256* 1.00), (u8)(-256* 2.60) }, //  (u8)誤キャストの誤パラメータのままの方が { 171, /*(u8)*/(-256* 1.00), /*(u8)*/(-256* 2.60) }, //  (u8)誤キャストの誤パラメータのままの方が
0xDA20, // システムとしては良好な動作 0xDA20, // システムとしては良好な動作
{ 0x69, 0x67 }, { 0x69, 0x67 },
}, },

View File

@ -94,7 +94,7 @@
/* FLMD0 control bit */ /* FLMD0 control bit */
#ifndef _WIN32 #ifdef _78K0R
#define FSL_FLMD0_HIGH {BECTL.7 = 1;} #define FSL_FLMD0_HIGH {BECTL.7 = 1;}
#define FSL_FLMD0_LOW {BECTL.7 = 0;} #define FSL_FLMD0_LOW {BECTL.7 = 0;}
#else #else

View File

@ -3,7 +3,7 @@
$Id: asdf$ $Id: asdf$
======================================================== */ ======================================================== */
#ifndef _WIN32 #ifdef _78K0R
#pragma SFR #pragma SFR
#endif #endif

View File

@ -1,6 +1,10 @@
#ifndef _hal_h_ #ifndef _hal_h_
#define _hal_h_ #define _hal_h_
#ifndef _78K0R
//#define bit bool
#define bit unsigned char
#endif
extern bit PM_EXTDC_n; extern bit PM_EXTDC_n;
extern bit BT_IN_CHG_n; extern bit BT_IN_CHG_n;
@ -9,6 +13,7 @@ extern bit SW_HOME_n;
extern bit SW_WIFI_n; extern bit SW_WIFI_n;
extern bit SHELL_OPEN; extern bit SHELL_OPEN;
// ======================================================== // ========================================================
void hal_update(); void hal_update();
void hal_reset(); void hal_reset();

View File

@ -4,7 +4,7 @@
'09 Apr '09 Apr
$Id: i2c_ctr.c 418 2011-09-22 01:35:37Z n2232 $ $Id: i2c_ctr.c 418 2011-09-22 01:35:37Z n2232 $
======================================================== */ ======================================================== */
#ifndef _WIN32 #ifdef _78K0R
#pragma interrupt INTIICA1 int_iic_ctr RB1 #pragma interrupt INTIICA1 int_iic_ctr RB1
#endif #endif
@ -46,7 +46,6 @@
#define TRC TRC1 #define TRC TRC1
#define SMC SMC1 #define SMC SMC1
#define DFC DFC1 #define DFC DFC1
#define IICS IICS1
#define PortMode PM20 #define PortMode PM20
#define Port P20 #define Port P20

View File

@ -4,7 +4,7 @@
'09 Feb - '09 Feb -
$Id$ $Id$
======================================================== */ ======================================================== */
#ifndef _WIN32 #ifdef _78K0R
#pragma sfr #pragma sfr
#pragma di #pragma di
#pragma ei #pragma ei

View File

@ -4,7 +4,7 @@
'09 Feb - '09 Feb -
$Id$ $Id$
======================================================== */ ======================================================== */
#ifndef _WIN32 #ifdef _78K0R
#pragma sfr #pragma sfr
#pragma di #pragma di
#pragma ei #pragma ei

View File

@ -3,15 +3,13 @@
$Id: i2c_twl.c 418 2011-09-22 01:35:37Z n2232 $ $Id: i2c_twl.c 418 2011-09-22 01:35:37Z n2232 $
======================================================== */ ======================================================== */
#ifndef _WIN32 #ifdef _78K0R
# pragma sfr /* 特殊機能レジスタ使用 */
#pragma sfr /* 特殊機能レジスタ使用 */
#endif #endif
/*============================================================================*/ /*============================================================================*/
#ifndef _WIN32 #ifdef _78K0R
# pragma interrupt INTIICA0 int_iic_twl RB2 # pragma interrupt INTIICA0 int_iic_twl RB2
#endif #endif

View File

@ -1,4 +1,5 @@
#ifndef _WIN32 #ifdef _78K0R
#pragma SFR #pragma SFR
#pragma di #pragma di
#pragma ei #pragma ei
@ -7,16 +8,19 @@
#pragma halt #pragma halt
#endif #endif
#ifndef _WIN32 #ifdef _78K0R
#pragma section @@CODE ROM_CODE #pragma section @@CODE ROM_CODE
//#pragma section @@CNST ROM_CNST //#pragma section @@CNST ROM_CNST
#endif #endif
#ifdef _WIN32 #ifdef _WIN32
// VCの赤線をどうにかする // VCの赤線をどうにかする
#include "sim/simOnWin.h" # include "sim/simOnWin.h"
# endif #endif
#ifdef _IAR
# include "sim/simOnWin.h"
#endif
//========================================================= //=========================================================

View File

@ -5,7 +5,7 @@
$Id: asdf$ $Id: asdf$
======================================================== */ ======================================================== */
#ifndef _WIN32 #ifdef _78K0R
#pragma SFR #pragma SFR
#pragma di #pragma di
#pragma ei #pragma ei
@ -13,7 +13,6 @@
#pragma stop #pragma stop
#pragma halt #pragma halt
#pragma section @@CODE LDR_CODE #pragma section @@CODE LDR_CODE
#pragma section @@CODEL LDR_CODL #pragma section @@CODEL LDR_CODL
@ -23,11 +22,14 @@
#endif #endif
# ifdef _WIN32 #ifdef _WIN32
// VCの赤線をどうにかする // VCの赤線をどうにかする
#include "sim/simOnWin.h" #include "sim/simOnWin.h"
# endif # endif
#ifdef _IAR
# include "sim/simOnWin.h"
#endif
//========================================================= //=========================================================
#include "jhl_defs.h" #include "jhl_defs.h"

View File

@ -3,7 +3,7 @@
$Id$ $Id$
======================================================== */ ======================================================== */
#ifndef _WIN32 #ifdef _78K0R
#pragma nop #pragma nop
@ -11,11 +11,11 @@
#include "config.h" #include "config.h"
#ifndef _WIN32 #ifdef _78K0R
#ifdef _WDT_CHECK_ # ifdef _WDT_CHECK_
#pragma interrupt INTWDTI fn_intwdti // wdt debug # pragma interrupt INTWDTI fn_intwdti // wdt debug
#endif # endif
//#pragma interrupt INTLVI fn_intlvi // ¢Žg—p //#pragma interrupt INTLVI fn_intlvi // ¢Žg—p

View File

@ -3,10 +3,8 @@
$Id: LED.c 418 2011-09-22 01:35:37Z n2232 $ $Id: LED.c 418 2011-09-22 01:35:37Z n2232 $
======================================================== */ ======================================================== */
#ifndef _WIN32 #ifdef _78K0R
# pragma sfr
#pragma sfr
#endif #endif
#include "incs.h" #include "incs.h"

View File

@ -17,7 +17,7 @@
#define LED_duty_notify_blu TDR02 #define LED_duty_notify_blu TDR02
// これらはduty変えられません // これらはduty変えられません
#ifndef _WIN32 #ifdef _78K0R
#define LED_pow_red P4.2 #define LED_pow_red P4.2
#define LED_CAM P7.5 #define LED_CAM P7.5
#else #else

View File

@ -5,12 +5,10 @@
OFFBLINK OFFが無視されます OFFBLINK OFFが無視されます
$Id$ $Id: asdf$
*********************************************************/ *********************************************************/
#ifndef _WIN32 #ifdef _78K0R
# pragma sfr
#pragma sfr
#endif #endif
#include "incs.h" #include "incs.h"

View File

@ -24,10 +24,8 @@ enum LED_ILUM_MODE{
LED_POW_ILM_CEOFF LED_POW_ILM_CEOFF
}; };
======================================================== */ ======================================================== */
#ifndef _WIN32 #ifdef _78K0R
# pragma sfr
#pragma sfr
#endif #endif
#include "incs.h" #include "incs.h"

View File

@ -8,7 +8,7 @@
$Id: loader.c 418 2011-09-22 01:35:37Z n2232 $ $Id: loader.c 418 2011-09-22 01:35:37Z n2232 $
======================================================== */ ======================================================== */
#ifndef _WIN32 #ifdef _78K0R
#pragma SFR #pragma SFR
#pragma di #pragma di
@ -21,7 +21,10 @@
#endif #endif
#include "incs_loader.h" #include "incs_loader.h"
#ifdef _78K0R
#include <fsl.h> #include <fsl.h>
#endif
#include "fsl_user.h" #include "fsl_user.h"
#include "i2c_ctr.h" #include "i2c_ctr.h"
@ -121,7 +124,7 @@ void main( )
//*/ //*/
hdwinit2( ); hdwinit2( );
#ifndef _WIN32 #ifdef _78K0R
// ファームの整合性チェック // // ファームの整合性チェック //
chk_firm_broke(); // 壊れていたら帰ってこない chk_firm_broke(); // 壊れていたら帰ってこない
#endif #endif
@ -198,7 +201,7 @@ static void chk_firm_broke()
void chk_platform_type() void chk_platform_type()
{ {
// ●CTRファミリ // // ●CTRファミリ //
system_status.family = (enum family_)( DEV_DET >> 1 ); /// あぁ... //iar! system_status.family = (enum family_)( DEV_DET >> 1 ); /// あぁ...
#ifdef _DBG_FORCE_SNAKE_ #ifdef _DBG_FORCE_SNAKE_
system_status.family = FAMILY_SNAKE; system_status.family = FAMILY_SNAKE;
#endif #endif

View File

@ -10,7 +10,7 @@
#include "magic.h" #include "magic.h"
#include "config.h" #include "config.h"
#ifndef _WIN32 #ifdef _78K0R
#pragma section @@CNSTL MGC_LOAD AT 0x0FF6 #pragma section @@CNSTL MGC_LOAD AT 0x0FF6
__far const unsigned char MGC_LOADd[] = __TIME__; __far const unsigned char MGC_LOADd[] = __TIME__;

View File

@ -6,7 +6,7 @@
$Id$ $Id$
********************************************************* */ ********************************************************* */
#ifndef _WIN32 #ifdef _78K0R
#pragma mul #pragma mul
#pragma div #pragma div
@ -16,7 +16,7 @@
#include "incs.h" #include "incs.h"
#ifndef _WIN32 #ifdef _78K0R
#include <math.h> #include <math.h>
#endif #endif

View File

@ -6,10 +6,8 @@
$Id: pm.c 418 2011-09-22 01:35:37Z n2232 $ $Id: pm.c 418 2011-09-22 01:35:37Z n2232 $
======================================================== */ ======================================================== */
#ifndef _WIN32 #ifdef _78K0R
# pragma nop
#pragma nop
#endif #endif
#include "incs.h" #include "incs.h"
@ -20,7 +18,10 @@
#include "batt_params.h" #include "batt_params.h"
#include <fsl.h> #ifdef _78K0R
# include <fsl.h>
#endif
#include "fsl_user.h" #include "fsl_user.h"
#include "vreg_twl.h" #include "vreg_twl.h"
@ -1337,7 +1338,7 @@ void bt_param_select()
{ {
bt_type_temp += BT_PARAM_SNAKE_MAXELL; bt_type_temp += BT_PARAM_SNAKE_MAXELL;
} }
p_bt_param = &bt_param[ bt_type_temp ]; // iar! p_bt_param = &bt_param[ bt_type_temp ];
} }

View File

@ -24,10 +24,10 @@
//========================================================= //=========================================================
#ifdef _WIN32 #ifdef _78K0R
#define LED_CHARGE mcuRegP[ _P2_4 ]
#else
#define LED_CHARGE P2.4 #define LED_CHARGE P2.4
#else
#define LED_CHARGE mcuRegP[ _P2_4 ]
#endif #endif

View File

@ -5,10 +5,9 @@
$Id$ $Id$
**********************************************************/ **********************************************************/
#pragma SFR
#include "incs_loader.h" #include "incs_loader.h"
#ifdef _78K0R
void my_reboot(){ void my_reboot(){
#asm #asm
@ -21,3 +20,10 @@ void my_reboot(){
#endasm #endasm
} }
#endif
#ifdef _IAR
void my_reboot(){
}
#endif

View File

@ -1,4 +1,4 @@
#ifndef _WIN32 #ifdef _78K0R
#pragma section @@CODE ROM_CODE #pragma section @@CODE ROM_CODE
#pragma nop #pragma nop
@ -9,6 +9,11 @@
#endif #endif
#ifdef _IAR
typedef unsigned char bit;
typedef unsigned char u8;
#endif
#ifdef _WIN32 #ifdef _WIN32
typedef unsigned char bit; typedef unsigned char bit;
typedef unsigned char u8; typedef unsigned char u8;
@ -29,9 +34,15 @@ typedef unsigned char u8;
#include "..\util_funcs.h" #include "..\util_funcs.h"
#ifdef _IAR
#include "../sim/simOnWin.h"
#endif
#ifdef _WIN32 #ifdef _WIN32
#include "../sim/simOnWin.h" #include "../sim/simOnWin.h"
#endif #endif
//#define _renge_test_ //#define _renge_test_
#define true 1 #define true 1
@ -218,7 +229,7 @@ __callt err renge_task_immed_run(){
rv = tasks_immed[ list_id ](); // タスク実行 rv = tasks_immed[ list_id ](); // タスク実行
if( rv == ERR_SUCCESS ) if( rv == ERR_SUCCESS )
{ {
tasks_immed[ list_id ] = TSK_IMM_DELETED_; // iar! tasks_immed[ list_id ] = TSK_IMM_DELETED_;
} }
// きわどいタイミングで同じタスクの登録があると困るのでDI状態でかえって来る事がある // きわどいタイミングで同じタスクの登録があると困るのでDI状態でかえって来る事がある
} }

View File

@ -12,11 +12,21 @@
******************************************************************************/ ******************************************************************************/
#ifdef _78K0R
typedef unsigned char u8; typedef unsigned char u8;
typedef signed char s8; typedef signed char s8;
typedef unsigned short u16; typedef unsigned short u16;
typedef signed short s16; typedef signed short s16;
#else
#define __callt
#endif
// ************************************ // ************************************
#define SYS_INTERVAL_TICK 1.953 #define SYS_INTERVAL_TICK 1.953

View File

@ -17,8 +17,8 @@ extern task_status_immed tski_vol_update();
// ************************************* // *************************************
#define TSK_IMM_EMPTY_ ( void * )( 0x0000 ) #define TSK_IMM_EMPTY_ ( task_status_immed )( 0x0000 )
#define TSK_IMM_DELETED_ ( void * )( 0x0001 ) #define TSK_IMM_DELETED_ ( task_status_immed(*)() )( 0x0001 )

View File

@ -21,7 +21,7 @@ extern void tsk_misc();
extern void tsk_status(); extern void tsk_status();
extern void tsk_sys(); extern void tsk_sys();
const void ( *tasks[ TSK_LAST ] )() = { /*const*/ void ( *tasks[ TSK_LAST ] )() = {
tsk_sw, tsk_sw,
tsk_adc, tsk_adc,
tsk_batt, tsk_batt,

View File

@ -2,11 +2,9 @@
RTC RTC
$Id$ $Id$
======================================================== */ ======================================================== */
#ifndef _WIN32 #ifdef _78K0R
# pragma sfr
#pragma sfr # pragma inline
#pragma inline
#endif #endif
#include "incs.h" #include "incs.h"

View File

@ -1,8 +1,8 @@
/* ======================================================== /* ========================================================
$Id$ $Id: qqqqq$
======================================================== */ ======================================================== */
#ifndef _WIN32 #ifdef _78K0R
#pragma SFR #pragma SFR
#pragma di #pragma di
@ -74,12 +74,12 @@ const u8 fsl_low_voltage_u08 = 1;
#define WTIM WTIM1 #define WTIM WTIM1
#endif #endif
#ifndef _WIN32 #ifdef _78K0R
#define LED_POW1 P4.2 #define LED_POW1 P4.2
#define LED_PM_POW1 PM4.2 #define LED_PM_POW1 PM4.2
#else #else
#define LED_POW1 mcuRegP[ _P4_2 ] #define LED_POW1 mcuRegP[ _P4_2 ]
#define LED_PM_POW1 mcuRegPM[ _P4_2 ] #define LED_PM_POW1 mcuRegPM[ _P4_2 ]
#endif #endif
// ======================================================== // ========================================================

View File

@ -7,7 +7,7 @@
$Id$ $Id$
======================================================== */ ======================================================== */
#ifndef _WIN32 #ifdef _78K0R
#pragma SFR #pragma SFR
#pragma NOP #pragma NOP

View File

@ -2,7 +2,7 @@
$Id$ $Id$
======================================================== */ ======================================================== */
#ifndef _WIN32 #ifdef _78K0R
#pragma SFR #pragma SFR
#pragma NOP #pragma NOP

View File

@ -5,7 +5,7 @@
$Id: task_misc.c 418 2011-09-22 01:35:37Z n2232 $ $Id: task_misc.c 418 2011-09-22 01:35:37Z n2232 $
======================================================== */ ======================================================== */
#ifndef _WIN32 #ifdef _78K0R
#pragma SFR #pragma SFR
#pragma NOP #pragma NOP

View File

@ -4,7 +4,7 @@
$Id$ $Id$
********************************************************* */ ********************************************************* */
#ifndef _WIN32 #ifdef _78K0R
#pragma SFR #pragma SFR
#pragma NOP #pragma NOP

View File

@ -4,7 +4,7 @@
$Id$ $Id$
======================================================== */ ======================================================== */
#ifndef _WIN32 #ifdef _78K0R
#pragma SFR #pragma SFR
#pragma NOP #pragma NOP
@ -338,7 +338,7 @@ void tsk_sys( )
LED_stop( ); LED_stop( );
IIC_ctr_Stop( ); IIC_ctr_Stop( );
IIC_twl_Stop( ); IIC_twl_Stop( );
RTC_32k_off(); //iar! RTC_32k_off();
// 電源オン条件の割り込みセット // 電源オン条件の割り込みセット
// PWSW KR3 押すとL // PWSW KR3 押すとL

View File

@ -10,7 +10,7 @@
#define bits8(a,b,c,d,e,f,g,h) ( a<<7 | b<<6 | c<<5 | d<<4 | e<<3 | f<<2 | g<<1 | h ) #define bits8(a,b,c,d,e,f,g,h) ( a<<7 | b<<6 | c<<5 | d<<4 | e<<3 | f<<2 | g<<1 | h )
#ifndef _WIN32 #ifdef _78K0R
// ŽÀ‹@ŠÂ‹« // ŽÀ‹@ŠÂ‹«
#ifdef _debug_led_ #ifdef _debug_led_

View File

@ -3,9 +3,9 @@
$Id$ $Id: asdf$
======================================================== */ ======================================================== */
#ifndef _WIN32 #ifdef _78K0R
#pragma SFR #pragma SFR
#pragma di #pragma di

View File

@ -96,8 +96,8 @@ void vreg_ctr_reset( )
vreg_ctr[ VREG_C_WIFI_CALIB ] = 0; vreg_ctr[ VREG_C_WIFI_CALIB ] = 0;
// ここでやるのは気持ち悪いが… // ここでやるのは気持ち悪いが…
RTC_32k_on(); //iar! RTC_32k_on();
RESET1_neg; //iar! RESET1_neg;
RESET2_neg; RESET2_neg;
FCRAM_RST_neg; FCRAM_RST_neg;
} }
@ -325,14 +325,14 @@ void vreg_ctr_write( u8 adrs, u8 data )
case VREG_C_WIFI_CALIB: case VREG_C_WIFI_CALIB:
if( data & REG_BIT_WIFI_CALIB_32K_HI_Z ) if( data & REG_BIT_WIFI_CALIB_32K_HI_Z )
{ {
RTC_32k_HI_Z(); //iar! RTC_32k_HI_Z();
} }
else{ else{
RTC_32k_on(); //iar! RTC_32k_on();
} }
if( data & REG_BIT_WIFI_CALIB_RSTS_AST ) if( data & REG_BIT_WIFI_CALIB_RSTS_AST )
{ {
RESET1_ast; //iar! RESET1_ast;
// RESET2_ast; RESET1のみ。 // RESET2_ast; RESET1のみ。
// FCRAM_RST_ast; // FCRAM_RST_ast;
} }