assembler/debugger
igor (1358) 20 posts |
Sorry for repeating the question in the other post.. but i think the topic title could have been misleading. thank u all for the answer i had.. still one point missing. I would like to practice assembly not in basic inline. i ve risc os on BBxm. which assembler should i use? Is there a step by step debugger? I fount extasm and armaliser/reporter.. are these correct choices? Thank u al very much. |
Garry (87) 184 posts |
I’m not an assembler guy, but I found this site: http://www.heyrick.co.uk/assembler/ Seems quite helpful. I don’t know anything about the tools you mention, but you could also have a look at GCC, it’s obviously a heavyweight set of tools, which may or may not be to your liking. Cheers Garry |
Martin Bazley (331) 379 posts |
First and foremost, why do you insist on not using BASIC’s inline assembler? It’s very much the simplest and easiest option, doesn’t require you to download any additional software at all, and I’d have thought would be by far the most suitable for a complete beginner such as yourself. For an ‘official’ solution, you can buy the C tools from the ROOL store (at least theoretically; they seem to be being a bit unhelpful at the moment, but I’m sure Steve will sort it out if you ask him by email), but it’ll set you back a hefty £40. For a free solution, GCC has been ported, but I believe the latest stable version is incompatible with the BeagleBoard and the unstable version is, erm, very unstable and largely incomplete, and I think you have to build it from source (which is a fat lot of good when you don’t already have a working compiler). (Also, beware of riscos.info – it’s one of many unmaintained RISC OS documentation websites which contains an awful lot of outdated material, so try not to click on any links.) The ROOL Tools have been updated to work on the BeagleBoard, and the assembler now has full support for ARMv7 instructions, but if you only want the assembler I’d still recommend BASIC. The BASIC on your computer can only assemble the original ARM instruction set, which will probably be enough for you, but if you want ARMv7 instructions in BASIC you should check out TBA Software’s project. For a free, sane, updated, and working solution, there is of course extASM, which you said you’d found. This has support for ARMv7 instructions and works on the BeagleBoard, but I’ve never used it so can’t give you advice. It may well be the best solution for you. Is there a step by step debugger? No. Absolutely not. Sorry. There were some, but I think all of them were abandoned before they could be updated to work on the BeagleBoard. (extASM may have one, but I don’t think it does.) ARMalyser and Reporter are useful tools, but one is a reverse engineering tool and the other is intended for BASIC and isn’t really suitable for assembler. I’m not sure what you were planning to do with them. Just as an example, in case you were afraid of BASIC, here’s how you can use it to assemble a program: (Disclaimer: untested!) codesize%=128:REM enough for a 128 byte program (way more than we need) DIM code% codesize%-1:REM allocate memory to assemble into FOR pass%=8 TO 10 STEP 2:REM two-pass assembly (to make labels work) P%=code%:L%=code%+codesize%:REM safeguard to make sure we don't overflow memory [OPT pass% ADR R0,string% SWI "OS_Write0" SWI "OS_Exit" .string% EQUS "Hello world!" EQUB 0 ALIGN ]:REM close square bracket denotes end of assembly NEXT REM you'll probably want to change this filename SYS "OS_File",10,"SCSI::4.$.HelloWorld",&FF8,,code%,P% |
igor (1358) 20 posts |
Thank u very much. The reason I don’t want to use Basic is that I ve no really need to develope an application. |
Jeffrey Lee (213) 6048 posts |
4.1.1 release 2 should work fine. However I think the assembler only supports up to ARMv6; for ARMv7 you’d have to build GCC 4.6 from source.
I’m not sure how stable it is nowadays, but you’re certainly right about having to build it from source.
It’s impossible to be built on RISC OS. You just build it on a Linux (or similar) PC instead. If everything works properly it should spit out a native RISC OS version of the compiler.
extASM doesn’t have a debugger. The only single-step debugger I know of that’s still being maintained is DDT, but that doesn’t run on the BeagleBoard yet, so there’s not much point looking at that. Unfortunately I don’t think there are any accurate and up-to-date tutorials on how to get started writing ARM assembler for RISC OS. I think the best sources of information are:
It’s important to know the difference between 26bit and 32bit code, otherwise there’s a good chance anything you write won’t run at all on the BeagleBoard. As a brief introduction:
|
Steve Drain (222) 1620 posts |
I think Martin would not be pleased to hear that Reporter is only intended for BASIC; I use it all the time in assembler, and very handy it is too. I do endorse your recommendation of the BASIC assembler, but I am aware that it might be a bit short for the new boards. I would recommend Darren Salt’s Extended BASIC Assembler, but you have to use it with version 1.20 and it is unlikely to be updated, I fear. |
Terje Slettebø (285) 275 posts |
The way I’ve usually been debugging (the extASM source itself is 21,000 lines of ARM assembly code) is the good old “print” method: Define a bunch of macros that lets you print out various things (and not disturb the registers). I have macros like this: MOV R0,#123 MOV R1,#456 ADD R2,R0,R1 Print3 "Add numbers, R0, R1, R2=",R0,R1,R2:NL When run, this will print: “Add numbers, R0, R1, R2=123 456 579” (newline) There’s also a “Get” macro, which does an OS_ReadC, i.e. pauses until you press a key. This has proved sufficient for all my debugging needs, and in fact even for higher-level languages I tend to prefer the “print” method to single-stepping in a debugger. To start with, I’d also recommend using the BASIC assembler, though, and you can develop similar “macros” for debugging, or for extending the instruction set, there: DEF FNnl [OPT pass% SWI OS_NewLine ] ="" ... (ARM instructions) FNnl ... |
Martin Avison (27) 1494 posts |
ARMalyser and Reporter are useful tools, but one is a reverse engineering tool and the other is intended for BASIC and isn’t really suitable for assembler. Strange, then, that I use Reporter extensively for debugging assembler (all written using the BASIC assembler). This includes several modules (eg ArmSort), and even Reporter itself! Macros are provided for use of Reporter from the BASIC assembler. Debug output is in a scrollable window, updated every WimpPoll. |
Trevor Johnson (329) 1645 posts |
Is EasyGCC something worth revisiting some time? |
igor (1358) 20 posts |
Thank u very much to u all for the support. |
Jan Rinze (235) 368 posts |
“for ARMv7 you’d have to build GCC 4.6 from source.” |
Colin Ferris (399) 1818 posts |
For a ARM Debugger:- |
igor (1358) 20 posts |
Hi, I wanted to try deskdebug, but the download doesn’t work… I asked them, and I m waiting since a couple of weeks.. |
Steve Revill (20) 1361 posts |
Just to put my oar in, I use Reporter to debug from BASIC, assembler and C code. It’s great! :) |