Re: assembly in Platform Builder
- From: "Dean Ramsier" <ramsiernospam@xxxxxxxxxx>
- Date: Fri, 22 Jul 2005 13:50:50 -0400
For starters, indentation matters. Look at the directives that are used in
the PB source, and write your code the same way with the same directives.
Remember, you're using a Microsoft ARM compiler, not someone else's. You
need to follow the Microsoft expected format and directives (which are
basically undocumented), and the best way to do that is to copy existing MS
code.
--
Dean Ramsier - eMVP
"angryswede" <angryswede@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:66FBDCA9-67D5-4E42-887C-7E9CA57DBC71@xxxxxxxxxxxxxxxx
> I have been looking at the startup.s file for reference actually, so I
know
> what the files look like.
>
> This is just some sample code off the net I was testing with.
>
> INCLUDE kxarm.h
>
> AREA Example, CODE, READONLY ; name of code block
>
> ENTRY ; 1st exec. instruction
>
> start
>
> MOV r0, #15
> MOV r1, #20
> BL func
> SWI 0x11
>
> func
> ADD r0, r0, r1 ; r0 = r0 + r1
> MOV pc, lr
>
> END
>
> My errors:
>
> BUILD: [01:0000000026:ERRORE]
> C:\WINCE500\PBWorkspaces\new\ARM\functions.s(1) : error A0051: unknown
> opcode: kxarm.h
> BUILD: [01:0000000028:ERRORE]
> C:\WINCE500\PBWorkspaces\new\ARM\functions.s(3) : error A0051: unknown
> opcode: Example
> BUILD: [01:0000000030:ERRORE]
> C:\WINCE500\PBWorkspaces\new\ARM\functions.s(9) : error A0051: unknown
> opcode: r0
> BUILD: [01:0000000032:ERRORE]
> C:\WINCE500\PBWorkspaces\new\ARM\functions.s(11) : error A0051: unknown
> opcode: r1
> BUILD: [01:0000000034:ERRORE]
> C:\WINCE500\PBWorkspaces\new\ARM\functions.s(13) : error A0051: unknown
> opcode: func
> BUILD: [01:0000000036:ERRORE]
> C:\WINCE500\PBWorkspaces\new\ARM\functions.s(15) : error A0051: unknown
> opcode: 0x11
> BUILD: [01:0000000038:ERRORE]
> C:\WINCE500\PBWorkspaces\new\ARM\functions.s(19) : error A0051: unknown
> opcode: r0
> BUILD: [01:0000000040:ERRORE]
> C:\WINCE500\PBWorkspaces\new\ARM\functions.s(21) : error A0051: unknown
> opcode: pc
>
> However, if I tried adding startup.s to my project just to see what would
> happen and it assembled fine, I did have some linking errors though, but
the
> point is it recognized those registers.
>
> I am not sure what's going on, but thanks for your help so far.
>
> "Dean Ramsier" wrote:
>
> > kxarm.h goes in the assembler file, not the C file. What does your
assembly
> > code look like? See .s files in
> > WINCE500\PLATFORM\MAINSTONEII\SRC\BOOTLOADER\EBOOT for an example of
what
> > ARM assembly looks like in Platform Builder.
> >
> > --
> > Dean Ramsier - eMVP
> >
> >
> > "angryswede" <angryswede@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> > news:CC42FE89-B70E-4526-A46B-FA200D0BA591@xxxxxxxxxxxxxxxx
> > > I have two files one is my cpp file which is calling functions in my
> > assembly
> > > file. If I include kxarm.h in the cpp it will try to treat kxarm.h
like a
> > > C++ file and get all sorts or errors. If I include it in my assembly
> > file,
> > > it will just ignore the kxarm.h and say it is an invalid opcode along
with
> > > all the registers I reference. Is there something else that needs to
be
> > done?
> > >
> > > "Dean Ramsier" wrote:
> > >
> > > > You should include kxarm.h (yes, it has an .h extension, but it's an
> > > > assembler include). This is located in PUBLIC\COMMON\SDK\INC
> > > >
> > > > Just reference the file in your sources file along with the rest of
your
> > > > files, the linker won't know or care that the output came from an
> > assembler
> > > > file.
> > > >
> > > > --
> > > > Dean Ramsier - eMVP
> > > >
> > > >
> > > > "angryswede" <angryswede@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> > > > news:BFB710F1-B08F-4E5A-8DB5-8570D81C4A8E@xxxxxxxxxxxxxxxx
> > > > > Do I need an include file for it to recognize the registers and do
I
> > need
> > > > to
> > > > > link the .obj output from the .s file in some manner?
> > > > >
> > > > > "bsqr_TSAT" wrote:
> > > > >
> > > > > > You can write your assembly code functions in separate files
named
> > with
> > > > a
> > > > > > ".s" extension. The tools will pick up the extension and
properly
> > > > invoke
> > > > > > the ARM assembler.
> > > > > >
> > > > > > You can call your assembly functions the same way that you would
> > call a
> > > > > > C/C++ function, but you must reference it properly so that the
> > linker
> > > > can
> > > > > > get through the name mangling and properly find it.
> > > > > >
> > > > > > Ex. If your assembler function is GetRegister(),
> > > > > > Then you will want to reference it with something like
this:
> > > > > >
> > > > > > extern "C" unsigned long GetRegister(void);
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > TSAT_BSQR
> > > > > >
> > > > > >
> > > > > > "angryswede" <angryswede@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
message
> > > > > > news:6F63278D-F37C-4B92-85F5-F9051A3924AC@xxxxxxxxxxxxxxxx
> > > > > > > Yeah, I've realized that does not work. What I am trying to
do is
> > > > check
> > > > > > > my
> > > > > > > performance count registers and scale the processor frequency.
> > I've
> > > > been
> > > > > > > writing in C++ the whole time in PB, so making the switch to
> > assembly
> > > > I am
> > > > > > > confused on how one goes about it.
> > > > > > >
> > > > > > > Fred Thomsen
> > > > > > >
> > > > > > > "Jimbo" wrote:
> > > > > > >
> > > > > > >> Well, using C and the _asm keyword, I can include x86
assembly
> > code
> > > > > > >> like this:
> > > > > > >>
> > > > > > >> _asm
> > > > > > >> {
> > > > > > >> place x86 asm code here
> > > > > > >> }
> > > > > > >>
> > > > > > >> Try it with ARM asm code.
> > > > > > >>
> > > > > > >>
> > > > > >
> > > > > >
> > > > > >
> > > >
> > > >
> > > >
> >
> >
> >
.
- Follow-Ups:
- Re: assembly in Platform Builder
- From: angryswede
- Re: assembly in Platform Builder
- References:
- assembly in Platform Builder
- From: angryswede
- Re: assembly in Platform Builder
- From: Jimbo
- Re: assembly in Platform Builder
- From: angryswede
- Re: assembly in Platform Builder
- From: bsqr_TSAT
- Re: assembly in Platform Builder
- From: angryswede
- Re: assembly in Platform Builder
- From: Dean Ramsier
- Re: assembly in Platform Builder
- From: angryswede
- Re: assembly in Platform Builder
- From: Dean Ramsier
- Re: assembly in Platform Builder
- From: angryswede
- assembly in Platform Builder
- Prev by Date: Re: force SNMP restart
- Next by Date: Re: assembly in Platform Builder
- Previous by thread: Re: assembly in Platform Builder
- Next by thread: Re: assembly in Platform Builder
- Index(es):
Relevant Pages
|