COP not responing as expected with BDM and jumping to a unexpected bank in banked mode

COP not responing as expected with BDM and jumping to a unexpected bank in banked mode

Post by codewarr20 » Thu, 10 Jun 2004 21:10:40


ROBLEM:
-----------
I am having trouble with the COP Reset Failure Interrupt Vector. I am
running in banked mode. With P&E BDM to the 256 eval board.

In Start12.c when I hit the _ENABLE_COP(7) I immediately jump to
BANK_33 which contains TERMINAL stuff and then locks up?

I also noticed that the COP macros are only good for NEAR banks, so I
additionally wrote procedures so I could call these from far banks.

Before I show you what I have done I would like to refer to the news
posting from the Yahoo group
http://groups.yahoo.com/group/68HC12/message/3065 that indicated that
the COP will not work with BDM so is that truly my problem?

Thanks in advance, T.


First my environment:

Using the MC68HC9S12DP256 CPU bean in Banked Mode, with
-CpPPAGE=RUNTIME

Code Warrior Tool Versions:
-----------------------------
ANSI-C/cC++ Compiler for HC12 V-5.0.24 Build 4047, Feb 17 2004

Common Module V-5.0.8, Date Feb 17 2004
User Interface Module, V-5.0.25 Date Feb 17 2004
ANSI-C/cC++ Front End, V-5.0.6, Date Feb 17 2004
Tree CSE Optimizer, V-5.0.1, Date Feb 17 2004
Compiler Common Module, V-5.0.1, Date Feb 17 2004
Generic ICG Back End V-5.0.2, Date Feb 17 2004
Compiler Back Common, V-5.0.2, Date Feb 17 2004
HC12 Back End V-5.0.24, Date Feb 17 2004
Encryption Module, V-5.0.3, Date Feb 17 2004

SmartLinker V-5.0.22 Build 4047, Feb 17 2004

Common Module V-5.0.8, Date Feb 17 2004
User Interface Module, V-5.0.25, Date Feb 17 2004
ELF/Dwarf Object Linking V-5.0.38, Date Feb 17 2004
HIWARE Object Linking V-5.0.51, Date Feb 17 2004
--------------------------------------------------------------
--------------------------------------------------------------


PRM File:
----------
DEFAULT_ROM INTO ROM_PAGE30,
ROM_PAGE31,
ROM_PAGE32,
ROM_PAGE33,
ROM_PAGE34,
ROM_PAGE35,
ROM_PAGE36,
ROM_PAGE37,
ROM_PAGE38,
ROM_PAGE39;
/* ROM_PAGE3A;*/ // Allocated
/* ROM_PAGE3B;*/ // Allocated.
/*, ROM_PAGE3C;*/ // Allocated.
/*, ROM_PAGE3D;*/ // Allocated.


TSI_DEBUG INTO ROM_PAGE3A;

TSI_INITLALIZE_FLOW_BOARD_CODE,
TSI_PROBE_CODE

INTO ROM_PAGE3B;

MY_PPAGE_3C_CODE_SEGNAME,
MY_PPAGE_3C_CONST_SEGNAME INTO ROM_PAGE3C; // Testing

In Vectors.c:
---------------

#pragma CODE_SEG __NEAR_SEG NON_BANKED
__interrupt void isrErrorHandler(void) {
// place a breakpoint here to catch/debug unexpected interrupt events
}


The end of the vector table:
Cpu_Interrupt, /* 60 Default (unused)
interrupt */
isrErrorHandler, //_EntryPoint, /* 61 INT_COPFailureReset */
Cpu_Interrupt, /* 62 Default (unused)
interrupt */
_EntryPoint /* Reset vector */
};



In Start12.c I have these set:
------- ---------- ---------

//#define _DO_FEED_COP_ //: do feed the COP --
 
 
 

COP not responing as expected with BDM and jumping to a unexpected bank in banked mode

Post by MW Ro » Wed, 16 Jun 2004 23:31:07

In article < XXXX@XXXXX.COM >,



Here is our best guess if it his doesn't work you may want to submit a
service request to CodeWarrior support.


The entries in the HC12 (or HCS12) interrupt table are 2 byte wide.
This means that all function you want to associate with an interrupt
or exception
vector must be allocated in NON BANKED memory (usually between 0xC000
and 0xFEFF).

In order to make sure these functions are allocated in NON-BANKED
memory,
I would suggest to allocate them in a NEAR segment.
1- You can use the predefined NON_BANKED segment.
In this case the function should be implemented as follows:
#pragma CODE_SEG __NEAR_SEG NON_BANKED /* Interrupt section for this
module.
Placement will be in
NON_BANKED area. */
__interrupt void MyISR(void)
{
/* Add Code Here*/
}
#pragma CODE_SEG _DEFAULT

2- You can use a user defined near segment.
In this case the function should be implemented as follows:
#pragma CODE_SEG __NEAR_SEG INT_SEG /* Interrupt section for this
module.
Placement will be in NON_BANKED
area. */
__interrupt void MyISR(void)
{
/* Add Code Here*/
}
#pragma CODE_SEG _DEFAULT
In this case customer will need to modify the PRM file as well.
In the placement block, he will have to add the INT_SEG segment:

PLACEMENT
_PRESTART, STARTUP,
ROM_VAR, STRINGS,
VIRTUAL_TABLE_SEGMENT,
NON_BANKED, INT_SEG, COPY INTO ROM_C000, ROM_4000;
... cont. ...

I hope this helps.

Ron

--
Metrowerks, one of the world top 100 companies and influencers
in the software development industry. - SD Times May 2004
http://www.yqcomputer.com/

Metrowerks, maker of CodeWarrior
Ron Liechty - XXXX@XXXXX.COM - http://www.yqcomputer.com/