Hcs12

Páginas: 30 (7468 palabras) Publicado: 28 de noviembre de 2010
CHANGE THE FUTURE

Working with the S12 Family and CodeWarrior Tips and Tricks Cesar Manzanarez
TIC México
TM

Freescale Semiconductor Confidential and Proprietary Information. Freescale™ and the Freescale logo are trademarks  of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2006.

1 Introduction
What is this training about ?

TM

Agenda
S12 Family Overview Memory map Linker Parameter File Remaping memory resources Map File Memory models EEPROM Module Review Break Optimizing calling conventions by hand Running routines in RAM Running routines from the Stack Mixing C and Assembly code Linking libraries EEPROM Interaction

Understanding memory architecture

Hands on/Codeexamples

Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2006.

TM

3

S12 Programmer Model Reminder

TM

S12 Programming Model

Used for branch conditions. Determinesto the next instruction tocontentsThean index used to Points operandsand result ofThe be executed Hold to the last used location of the stack of stack is Points Indexed Addressing. operations register are added and temporary data mask (Stores processor flags constants interruptcontent bit) save system contextto and the or to thestorage. of an accumulator to form the effective address of the instruction operand.

Freescale™ and the Freescale logo are trademarks ofFreescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2006.

TM

5

Quick reminder of addressing modes
Inherent Immediate Direct No address needed Address supplied as operand Operand in the first 8-bit address space (zero page addressing) Operand in the 16-bit address space Address supplied as offsetfrom the current PC value Address supplied as offset from IndexRegister INX LDAA #$55 LDAA $55 LDAA $F03B JSR 7,PC STAB –8,Y

Extended Relative Indexed

Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2006.

TM

6

Instruction set efficiencyExample of instruction

Number of bytes taken by the instruction

Each letter here indicates one CPU cycle

Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2006.

TM

7

S12 Internal Resources

All of these resources need to be accessed usingI/O Registers a 16-bit address and a paging convention.

Example : S12D Family

Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2006.

TM

8

How to address all these resources with 16 bit addresses?

I/O Registers

Freescale™ and theFreescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2006.

TM

9

Flash Memory Space

The Flash’ 512 K are divided into 32 pages of 16K.

PAGE 0x20

PAGE 0x21

...

PAGE 0x3E

PAGE 0x3F

Flash pages are numbered and the last page is number 3F

Freescale™and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2006.

TM

10

Flash Memory space
0x0000

Where does this fit in the 64K memory map?
0x4000

These pages are mirrored to the 0x8000-0xBFFF Memory range.

0x8000

PAGE 0x20 0xC000

PAGE 0x21

......
Leer documento completo

Regístrate para leer el documento completo.

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS