Assembly Language Programming

Started by szoshi, October 21, 2015, 06:16:51 PM

Previous topic - Next topic

szoshi

Hello,

I am looking for an open hardware board where I can program some small bits directly using assembly language. Would it be possible using an OLINUXINO board? The way I see it I have to generate an executable file for my SD card and that should be it. The big advantage here would be the availability of the schematics of the board used.

Am I thinking on the right lines here?

Any hekp would be greatly appreciated.

Shailesh

MBR

You don't need assembly language to "program some small bits directly". If the speed does not matter, you can play with GPIO pins in Linux even from a shell/script via files in the /sys/class/gpio directory. If you want the speed, you can access the GPIO (and other) registers directly, but because ARM CPUs do not have separate I/O space (as, for example, Intel's  x86), you have to map the MMIO area into the user space with the syscall mmap() (you need the root privileges to do that) and then access them as a memory. But even then, almost all operations can be done with low-level languages like C (bit toggling/masking/shifting, accessing any address in the memory via pointer aritmetics etc.), unless you want to program the "bare metal" without any OS ...

JohnS

In case you don't want an OS (such as Linux), think what U-boot does and look at its source code.

John

szoshi

Hello again,

I have taken your advice and looked around for the UBoot code. I have procured an Olimex board in the hope that I can begin some elementary Assembly programming soon.

I have been reading up on the boot loader and came up across some good information here:
http://linux-sunxi.org/BROM

I have also found a couple of good tutorials about how to compile my asm code and have managed to build a small kernel image (36 bytes)

The problem I have now is how to transfer this image to a micro SD card and make the program run on my board. Once i have managed this I will have a toolchain from idea to execution. Can someone point me to a good source where I can learn how to go about making a bootable SD card? Btw I am a novice Linux user and have managed everything so far on a windows machine.

Many thanks in advance.

Kind regards,
Shailesh

JohnS

On Linux it's trivial
dd if=yourfile of=whereyouwantit

See
man dd

Even better, see how uboot is put on a device

John

szoshi

#5
Thanks John,

I am guessing the seek=8 command is owing to the article here:

http://linux-sunxi.org/Bootable_SD_card

By doing that I am putting my tiny kernel in place of the initial SPL?

I have read on the boot process page that the chip looks for a valid boot signature to hand over control to the OS/UBoot or else it enters the FEL mode. This is mentioned here:

http://linux-sunxi.org/Boot_Process

I am guessing that my initial SPL will be executed irrespective of a valid signature?

Regards,

Shailesh

MBR

Quote from: szoshi on November 12, 2015, 01:06:51 PM
I have read on the boot process page that the chip looks for a valid boot signature to hand over control to the OS/UBoot or else it enters the FEL mode. This is mentioned here:

http://linux-sunxi.org/Boot_Process

I am guessing that my initial SPL will be executed irrespective of a valid signature?

IMHO no, the boot signature is essential for loading from NAND flash (because bad blocks) and the bootloader probably uses the same code to check all bootable media. Even on x86 (in legacy boot mode), you need boot signature 0x55 0xAA on the very end of the first sector.