Hello guys,

Is the .s file exports some fuctions that called by ISR.

For example ,if the following code exports the fuctions?

how to call the functions in .c files?

thanks,
Peter

;* @date 2002/04/08
;*
;* Log:
;* 2002/04/08 Start
;*
;******************************************************************************

INCLUDE kxarm.h

PHY_RAM_START EQU 0x30000000
VIR_RAM_START EQU 0x8c000000

TEXTAREA

LEAF_ENTRY Launch

ldr r2, = PhysicalStart
ldr r3, = (VIR_RAM_START - PHY_RAM_START)

sub r2, r2, r3

mov r1, #0x0070 ; Disable MMU
mcr p15, 0, r1, c1, c0, 0
nop
mov pc, r2 ; Jump to PStart
nop

; MMU & caches now disabled.

PhysicalStart

mov r2, #0
mcr p15, 0, r2, c8, c7, 0 ; Flush the TLB
mov pc, r0 ; Jump to program we are launching.

;++
; Routine:
;
; ShowLights
;
; Description:
;
; Set the Hexadecimal LED array to the values specified
;
; Arguments:
;
; r0 = word containing 8 nibble values to write to the Hexadecimal
LED
;
;
;--

LEAF_ENTRY ShowLights

mov pc, lr

END

Re: Does .S files defines and implements some fuctions for the ISR? by Valter

Valter
Mon Jun 19 04:41:36 CDT 2006

"Peter King" <wangzilue@tom.com> wrote in
news:eHth3A4kGHA.2280@TK2MSFTNGP02.phx.gbl:

[...]

.s files are assembly files and they can export functions to C/C++
using the EXPORT keyword.
They can also import and call or use functions and variables declared
in other obj files (generated from C/C++ sources or ASM files).

Using of assembler in an ISR is not mandatory, but it could be that on
some platform you have ASM functions called by your ISR. On the ARM-
based BSPs I know I never saw ASM ISR or ASM function called inside an
ISR.
The code you sent looks like startup code and not an ISR.

--
Valter Minute
(the reply address of this message is invalid)
(l'indirizzo di reply di questo messaggio non è valido)

Re: Does .S files defines and implements some fuctions for the ISR? by voidcoder

voidcoder
Mon Jun 19 04:56:25 CDT 2006

You just need to declare that function as extern.
Example:

*.s

LEAF_ENTRY SomeAsmFunction ; r0 contains param0

STMFD sp!, {r1-r2, lr} ; save used regs
....
....
....
MOV r0, ... ; return value
LDMFD sp!, {r1-r2, lr} ; restore used regs
MOV pc, lr


*.c / *.cpp

extern BOOL SomeAsmFunction(DWORD param0);


if (SomeAsmFunction(0x1234))
{
// ....
}


There are few easy rules when calling ARM asm routines:

1. The params are passed through r0, r1, r2, etc registers.

2. The return value is returned through r0 register.




"Peter King" <wangzilue@tom.com> wrote in message news:eHth3A4kGHA.2280@TK2MSFTNGP02.phx.gbl...
> Hello guys,
>
> Is the .s file exports some fuctions that called by ISR.
>
> For example ,if the following code exports the fuctions?
>
> how to call the functions in .c files?
>
> thanks,
> Peter
>
> ;* @date 2002/04/08
> ;*
> ;* Log:
> ;* 2002/04/08 Start
> ;*
> ;******************************************************************************
>
> INCLUDE kxarm.h
>
> PHY_RAM_START EQU 0x30000000
> VIR_RAM_START EQU 0x8c000000
>
> TEXTAREA
>
> LEAF_ENTRY Launch
>
> ldr r2, = PhysicalStart
> ldr r3, = (VIR_RAM_START - PHY_RAM_START)
>
> sub r2, r2, r3
>
> mov r1, #0x0070 ; Disable MMU
> mcr p15, 0, r1, c1, c0, 0
> nop
> mov pc, r2 ; Jump to PStart
> nop
>
> ; MMU & caches now disabled.
>
> PhysicalStart
>
> mov r2, #0
> mcr p15, 0, r2, c8, c7, 0 ; Flush the TLB
> mov pc, r0 ; Jump to program we are launching.
>
> ;++
> ; Routine:
> ;
> ; ShowLights
> ;
> ; Description:
> ;
> ; Set the Hexadecimal LED array to the values specified
> ;
> ; Arguments:
> ;
> ; r0 = word containing 8 nibble values to write to the Hexadecimal LED
> ;
> ;
> ;--
>
> LEAF_ENTRY ShowLights
>
> mov pc, lr
>
> END
>
>
>



Re: Does .S files defines and implements some fuctions for the ISR? by Peter

Peter
Mon Jun 19 05:01:43 CDT 2006

Hi Valter,

Is ISR moving the data from the register to memory?
could you show me a example that implement the ISR?
I cann't quite understand the proccess.

Thanks,
Peter

.s files are assembly files and they can export functions to C/C++
> using the EXPORT keyword.
> They can also import and call or use functions and variables declared
> in other obj files (generated from C/C++ sources or ASM files).
>
> Using of assembler in an ISR is not mandatory, but it could be that on
> some platform you have ASM functions called by your ISR. On the ARM-
> based BSPs I know I never saw ASM ISR or ASM function called inside an
> ISR.
> The code you sent looks like startup code and not an ISR.
>
> --
> Valter Minute
> (the reply address of this message is invalid)
> (l'indirizzo di reply di questo messaggio non ?valido)



Re: Does .S files defines and implements some fuctions for the ISR? by Valter

Valter
Mon Jun 19 05:29:50 CDT 2006

"Peter King" <wangzilue@tom.com> wrote in
news:eBFnid4kGHA.1936@TK2MSFTNGP04.phx.gbl:

> Hi Valter,
>
> Is ISR moving the data from the register to memory?
> could you show me a example that implement the ISR?
> I cann't quite understand the proccess.
>

The ISR should simply recognize the interrupt, disable it, and return
a code (SYSINTR) to the system. Usually a typical ISR checks the
interrupt source, disable the specific interrupt and return a SYSINTR
code.
You may find a sample of it in your BSP!
On wich platform are you working?

On this link
http://bsa1981.altervista.org/intrdemo.zip
you may find a simple flash presentation that shows how you could add
the handling of a new interrupt to the mainstone II BSP.
It explains only the ISR, but if you need it I can send you also a
simple IST application.

--
Valter Minute
(the reply address of this message is invalid)
(l'indirizzo di reply di questo messaggio non è valido)

Re: Does .S files defines and implements some fuctions for the ISR? by Peter

Peter
Mon Jun 19 05:56:49 CDT 2006

Hi Valter,

When I write the MC8051 program,there is buffer to recive or send the date
in the UART communication.And if there is date recived we can read the
buffer directly instead of reading the bit one by one according to the
timing graph.

However,Does the WinCE driver program have the same mechanism as MC8051?
If yes ,generally where is the buffer defined?

If the ISR doesn't copy the data from register to buffer,
which code implement this function ?

How does the chip read the data ?Is it one bit by one
bit,or read the buffer?


thanks a lot,
Peter

> The ISR should simply recognize the interrupt, disable it, and return
> a code (SYSINTR) to the system. Usually a typical ISR checks the
> interrupt source, disable the specific interrupt and return a SYSINTR
> code.
> You may find a sample of it in your BSP!
> On wich platform are you working?
>
> On this link
> http://bsa1981.altervista.org/intrdemo.zip
> you may find a simple flash presentation that shows how you could add
> the handling of a new interrupt to the mainstone II BSP.
> It explains only the ISR, but if you need it I can send you also a
> simple IST application.
>
> --
> Valter Minute
> (the reply address of this message is invalid)
> (l'indirizzo di reply di questo messaggio non ?valido)



Re: Does .S files defines and implements some fuctions for the ISR? by Valter

Valter
Mon Jun 19 09:10:42 CDT 2006

"Peter King" <wangzilue@tom.com> wrote in
news:#amMS84kGHA.1456@TK2MSFTNGP04.phx.gbl:

> Hi Valter,
>
> When I write the MC8051 program,there is buffer to recive or send
> the date in the UART communication.And if there is date recived we
> can read the buffer directly instead of reading the bit one by one
> according to the timing graph.
>
> However,Does the WinCE driver program have the same mechanism as
> MC8051? If yes ,generally where is the buffer defined?
>
> If the ISR doesn't copy the data from register to buffer,
> which code implement this function ?
>
> How does the chip read the data ?Is it one bit by one
> bit,or read the buffer?

I don't know this specific device and so I can't reply to your
question. I suggest you to post a new thread with MC8051 in his
subject since this will attract the attention of people who know that
chip.



--
Valter Minute
(the reply address of this message is invalid)
(l'indirizzo di reply di questo messaggio non è valido)

Re: Does .S files defines and implements some fuctions for the ISR? by Peter

Peter
Mon Jun 19 11:52:37 CDT 2006

Valter,

I am sorry ,I didn't say it clearly.
I want to know how does the driver program move the data from register to
the memory(buffer).
Which code implement this funtion?
Could you give me a example ,any device is OK.

Thanks,
Peter



Re: Does .S files defines and implements some fuctions for the ISR? by Dean

Dean
Mon Jun 19 15:37:28 CDT 2006

Registers are just locations in address space. Nothing special needs to be
done as long as you have them mapped properly, and no assembly code is
required.

--
Dean Ramsier - eMVP
BSQUARE Corporation


"Peter King" <wangzilue@tom.com> wrote in message
news:%23wmFHD8kGHA.1664@TK2MSFTNGP03.phx.gbl...
> Valter,
>
> I am sorry ,I didn't say it clearly.
> I want to know how does the driver program move the data from register to
> the memory(buffer).
> Which code implement this funtion?
> Could you give me a example ,any device is OK.
>
> Thanks,
> Peter
>



Re: Does .S files defines and implements some fuctions for the ISR? by Peter

Peter
Tue Jun 20 01:59:56 CDT 2006

Hello Dean,

Could you give me a example to show how to map the address?
How could the register pass the data to the mapped address?

Thanks,
Peter

> Registers are just locations in address space. Nothing special needs to
> be done as long as you have them mapped properly, and no assembly code is
> required.
>
> --
> Dean Ramsier - eMVP
> BSQUARE Corporation



Re: Does .S files defines and implements some fuctions for the ISR? by Dean

Dean
Tue Jun 20 07:59:48 CDT 2006

The register doesn't pass anything to a mapped address. The register IS the
mapped address. The API I would use in order to map the address is
MmMapIoSpace(). One of the parameters you pass it is the physical address
of the CPU register in question. You get that from the datasheet for the
CPU in question.

Note that I'm refering to registers in CPU memory space, not the general
purpose registers that are contained in the ALU/cpu core (r0, r1 etc in ARM,
AX, BX etc in X86). Maybe you should give a specific example of what you're
trying to do - which CPU, which register and why.
--
Dean Ramsier - eMVP
BSQUARE Corporation


"Peter King" <wangzilue@tom.com> wrote in message
news:OBpjmcDlGHA.1264@TK2MSFTNGP05.phx.gbl...
> Hello Dean,
>
> Could you give me a example to show how to map the address?
> How could the register pass the data to the mapped address?
>
> Thanks,
> Peter
>
>> Registers are just locations in address space. Nothing special needs to
>> be done as long as you have them mapped properly, and no assembly code is
>> required.
>>
>> --
>> Dean Ramsier - eMVP
>> BSQUARE Corporation
>
>