flat assembler
Message board for the users of flat assembler.

Index > Non-x86 architectures > FASMARM v1.43 - Cross assembler for ARM CPUs

Goto page Previous  1, 2, 3 ... 19, 20, 21 ... 30, 31, 32  Next
Author
Thread Post new topic Reply to topic
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17671
Location: In your JS exploiting you and your system
revolution
Version 1.20 now available:
Quote:
v1.20 2010-Sep-17
  • Fixed a bug with handling of files names in dwarf format
den_po: Please try your code again, your problem should now be fixed.
Post 17 Sep 2010, 08:23
View user's profile Send private message Visit poster's website Reply with quote
den_po



Joined: 17 Jul 2006
Posts: 23
Location: Russia, Cheboksary
den_po
it works now. thanks.
Post 17 Sep 2010, 12:30
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
den_po



Joined: 17 Jul 2006
Posts: 23
Location: Russia, Cheboksary
den_po
Code:
 code16

  org 0x12701B04
      ldr r4, [.1]
        ldr r0, [undefinedlabel]

        dw 0

    db 10,0

.1:  dw 0
    


Quote:
flat assembler for ARM version 1.69.24 (1217415 kilobytes memory)
error: code cannot be generated.
Post 22 Sep 2010, 08:22
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17671
Location: In your JS exploiting you and your system
revolution
den_po: The ldr opcode cannot load from unaligned address in thumb mode. Use like this:
Code:
    code16
    org    0x12701B04
    ldr    r4,[.1]
    ldr    r0,[undefinedlabel]
    dw    0
    db    10,0
    align    4
.1:    dw    0    
Post 22 Sep 2010, 08:47
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17671
Location: In your JS exploiting you and your system
revolution
Perhaps I should explain why you get the error "code cannot be generated".

Because you have not set the PROCESSOR version fasmarm will assume you have a v7 capable CPU. With v7 code there are two options for the ldr opcode, one is an hword instruction (limited to addresses in a multiple of 4) and the other is a "wide" word instruction with byte granularity.
  • The first pass generates a hword opcode not knowing the forward referenced label will be unaligned.
  • The second pass generates a word opcode and succeeds.
  • The third pass sees that the label .1 is word aligned and generates an hword opcode, but this then places the label .1 unaligned again.
  • The fourth pass places a word opcode, a repeat of step 2.
  • Eventually we run out of passes and the assembler gives up.
Another way to solve is to force a wide instruction:
Code:
        ldr.w   r4,[.1]    
Post 22 Sep 2010, 08:55
View user's profile Send private message Visit poster's website Reply with quote
den_po



Joined: 17 Jul 2006
Posts: 23
Location: Russia, Cheboksary
den_po
i think error message must be more informative
Post 22 Sep 2010, 09:07
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17671
Location: In your JS exploiting you and your system
revolution
Do you have a suggestion?

BTW: This message is generated by the fasm portion of the code. The fasmarm code does not generate this error. So I would have to patch fasm in some way to change it.
Post 22 Sep 2010, 09:15
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17671
Location: In your JS exploiting you and your system
revolution
I've experimented with various ways to avoid the infinite loop created by some code sequences and I'm pleased with one particular method. If the assembler gets to a third repetition at the same state then code takes action and uses wide instructions in situations where the narrow instructions are causing problems.

For most cases this allows the natural settling of label values to occur without taking action too fast and forcing wide instructions prematurely. While at the same time not going endlessly around in circles hoping for a miracle to save it.

Of course there are still a few pathological cases where the code makes a sub-optimal choice but I doubt these occur much in real code. And if the user desperately wants absolutely optimal code then they would probably be using the .n and .w overrides anyway to get precisely what they need.

My feeling is it is more important to get the code compiled. I guess the principle I'm following here is: "Find a way to create what the user asked for and not force them to always decide how to optimise it in case of trouble". Sometimes the user doesn't want to be bothered with optimisation when first writing code. If they are following the "get it working, then get it fast" paradigm then automatically solving the "code cannot be generated" problem helps to get them there without undue complaining by the assembler. Later the user can decide to hand optimise if they find fasmam created something badly over-bloated for their liking.

Anyhow, I'll delay before putting this into the download in case there is something I have overlooked. Comments, criticisms and suggestions are welcome.
Post 24 Sep 2010, 00:30
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17671
Location: In your JS exploiting you and your system
revolution
Version 1.21 now available:
Quote:
v1.21 2010-Oct-17
  • Minimising the "code cannot be generated" problem. If the assembler gets to a third repetition at the same state then it takes action and uses wide instructions in situations where the narrow instructions are causing problems.
Post 17 Oct 2010, 12:30
View user's profile Send private message Visit poster's website Reply with quote
Tyler



Joined: 19 Nov 2009
Posts: 1216
Location: NC, USA
Tyler
revolution wrote:
Do you have a suggestion?

BTW: This message is generated by the fasm portion of the code. The fasmarm code does not generate this error. So I would have to patch fasm in some way to change it.
Maybe something about possible circular dependencies and running out of passes?
Post 17 Oct 2010, 12:48
View user's profile Send private message Reply with quote
den_po



Joined: 17 Jul 2006
Posts: 23
Location: Russia, Cheboksary
den_po
it's me again

a.asm
Code:
include "a.inc"
nop    


a.inc
Code:
format ELF dwarf executable
processor 0x3ff    


flat assembler for ARM version 1.69.25 (1466271 kilobytes memory)

Unhandled exception at 0x0040cdda in FASMARM.EXE: 0xC0000005: Access violation reading location 0x00000001.
Post 14 Nov 2010, 20:51
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17671
Location: In your JS exploiting you and your system
revolution
The error can be minimally described with:
Code:
format ELF dwarf executable
nop    
I will upload a fix soon.
Post 23 Nov 2010, 14:10
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17671
Location: In your JS exploiting you and your system
revolution
Version 1.22 now available:
Quote:
v1.22 2010-Nov-24
  • Fixed a bug with handling nameless sections in dwarf format
Post 23 Nov 2010, 23:21
View user's profile Send private message Visit poster's website Reply with quote
SFeLi



Joined: 03 Nov 2004
Posts: 140
SFeLi
Code:
        format  binary

        virtual at 0x00100000
          foo: bl 0x00020000
          load foo_instr dword from foo
        end virtual    

fasmarm wrote:
C:\Programs\fasmarm>fasmarm foo.asm
flat assembler for ARM version 1.69.25 (315598 kilobytes memory)
foo.asm [5]:
load foo_instr dword from foo
error: value out of range.

What’s wrong?
Post 29 Apr 2011, 19:38
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17671
Location: In your JS exploiting you and your system
revolution
SFeLi wrote:
Code:
        format  binary

        virtual at 0x00100000
          foo: bl 0x00020000
          load foo_instr dword from foo
        end virtual    

fasmarm wrote:
C:\Programs\fasmarm>fasmarm foo.asm
flat assembler for ARM version 1.69.25 (315598 kilobytes memory)
foo.asm [5]:
load foo_instr dword from foo
error: value out of range.

What’s wrong?
dword is a 64 bit value. bl is a 32 bit instruction. You can't load 8 bytes from a 4 byte address range.
Post 30 Apr 2011, 01:11
View user's profile Send private message Visit poster's website Reply with quote
SFeLi



Joined: 03 Nov 2004
Posts: 140
SFeLi
revolution wrote:
dword is a 64 bit value

Thank you.
Post 30 Apr 2011, 09:01
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4242
Location: 2018
edfed
i think it is time to tell everybody that:

Finally, Apple don't bought ARM. Smile

nobody pointed it here, and then, a lot of us still believe ARM is apple property.
Post 08 May 2011, 14:44
View user's profile Send private message Visit poster's website Reply with quote
den_po



Joined: 17 Jul 2006
Posts: 23
Location: Russia, Cheboksary
den_po
something wrong with dwarf again.
i want to add some patch to the compiler but when i add only 10 bytes of code/data to ANY place (fasmarm 1.22 + fasm 1.69.25) it fails at "call assembler".
Post 30 Jul 2011, 11:17
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17671
Location: In your JS exploiting you and your system
revolution
Post your code please.
Post 30 Jul 2011, 11:25
View user's profile Send private message Visit poster's website Reply with quote
den_po



Joined: 17 Jul 2006
Posts: 23
Location: Russia, Cheboksary
den_po
Code:
format ELF dwarf executable
nop    

it fails when i add 10 or more bytes to any place before include '..\armv7.inc'. try to add 10 characters to copyright string.
Post 30 Jul 2011, 18:51
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2, 3 ... 19, 20, 21 ... 30, 31, 32  Next

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.