mailto: blog -at- heyrick -dot- eu

Navi: Previous entry Display calendar Next entry
Switch to desktop version

FYI! Last read at 18:01 on 2024/11/21.

Final Beagle play

As my Beagle xM appears to be loading the x-loader, I thought I'd have a little play around to see if I could write an MLO to at least switch on the two LEDs.

This was not a success. :-( Without a JTAG to the board, I don't know if there is something wrong with the code, or if there is something wrong with the board (it is possible it takes an untrapped exception?). Maybe the loader is rejecting the code?
I'm more or less working blind, so... here's the code. Feel free to play with it.

The code is pretty simple. It flushes the instruction cache, turns off the MMU and data cache (but keeps instruction caching on). This should mean we're in an environment with a flat addressing. Then the GPIO5 is poked to set the LED pins as outputs, than to turn 'em on.

It is possible that in between the MMU stuff and the LED stuff, we might need to jump through some hoops for specifics of the OMAP3?

Note, also, that no attempt is made to fiddle with PLLs and clock speeds. We'll assume the ROM loader has set up a suitable default. We don't need to worry about clock speed, anything works for us right now...

; Basic MLO - test
;
; by Rick Murray
;   Version: 0.01
;   Date   : Sunday, 10th June 2012
;


; LED mask - USERLED0 = GPIO #149; USERLED1 = GPIO #150.
USERLED0        * 1 << 21
USERLED1        * 1 << 22

; GPIO5 base address held in code, it is &49056000.


; GPIO-specific register offsets (from GPIO base)
GPIO_OE         * &34
GPIO_DATAOUT    * &3C
GPIO_CLRDATAOUT * &90
GPIO_SETDATAOUT * &94


; ===========
; Here we go!
; ===========

   AREA     |MLO$Code|, CODE

   ENTRY

prefix
   EQUD   ((end - start) + 4)  ; size of image
   EQUD   &40200800            ; load address

start
   ; What we know at this point:
   ;
   ;   Our file must be called "MLO" and be less than 128K on a FAT12/16/32
   ;   filesystem (with/without MBR [but MBR-less is unusual]). [TRM p3578]
   ;
   ;   The L2 cache is disabled [TRM p3537]
   ;   Our code should be at &40200800
   ;   Stack should be at &4020F000 [TRM p3542]
   ;   Exceptions start at &4020FFC8 [TRM p3542]
   ;   Code must be prefixed by size [word] and address [word] [TRM p3590]
   ;   Code is entered in "public ARM supervisor mode" [wtf? you mean SVC32?]
   ;   R0 points to boot data structure (unimportant...) [TRM p3591]
   ;
   ; Helpfully, no mention is made of cache or MMU, so we'll assume it is all
   ; off at point of entry. This would be backed up by "When an MMU instance is
   ; released from reset, its TLB is empty and the MMU is disabled." [TRM p2673]
   ; We shall, however, be paranoid and force these things OFF in case the boot
   ; code made use of them...
   ;

   ; force ourselves into SVC32
   MRS    R0, CPSR
   BIC    R0, R0, #&1F
   ORR    R0, R0, #&D3
   MSR    CPSR, R0

   ; invalidate TLB and L1 instruction cache [just in case]
   MOV    R0, #0
   MCR    p15, 0, R0, c8, c7, 0 ; invalidate TLBs [ARM ARM 2nd pB3-26]
   MCR    p15, 0, R0, c7, c5, 1 ; invalidate icache [ARM ARM 2nd pB5-16]

   ; kill the MMU [just in case]
   MRC    p15, 0, R0, c1, c0, 0 ; read status [below, from Cortex-A8 TRM p3-59(etc)]
   BIC    R0, R0, #&2000        ; clear bit 13 'V' (set low vectors)
   BIC    R0, R0, #&7           ; clear bits 0-2 'CAM' (no dcache, alignchk off, mmu off)
   ORR    R0, R0, #&2           ; set bit 1 'A' (alignchk back on)
   ORR    R0, R0, #&1800        ; set bits 11 and 12 'IZ' (icache on, branch predict on)
   MCR    p15, 0, R0, c1, c0, 0 ; write it back

   ; With the MMU disabled, virtual addresses == physical addresses [ARM ARM 2nd pB3-5]

   ; set LED GPIO bits for output
   LDR    R10, =&49056000       ; GPIO base
   MOV    R1, R10
   ADD    R1, R1, #GPIO_OE
   ; Address to GPIO OE in R1

   MOV    R2, #USERLED0
   ADD    R2, R2, #USERLED1
   MVN    R3, R2
   ; Bitmask of LEDs in R2 (used for which pins to turn on)
   ; Inverted copy in R3 (used for AND NOT maths)

   ; force LED GPIOs to be outputs
   LDR    R0, [R1]              ; load
   AND    R0, R0, R3            ; modify: value = value AND NOT leds
   STR    R0, [R1]              ; store

   ; force LEDs on
   MOV    R1, R10
   ADD    R1, R1, #GPIO_SETDATAOUT
   STR    R2, [R1]

   ; dead loop - we're done for now...
dead_loop
   B      dead_loop


end
   END

 

Remind me what season this is!

Went to lay into some unwanted thistles. Wearing a jumper and coat. In mid June. What? What!?

It goes without saying that my rice didn't bother even attempting to sprout. My soya, on the other hand, burst out of the ground in a matter of days. They're doing well, all things considered.

Sprouting soya

It is a bit of a wilderness around here. I don't do mowing and stuff on work days, and weekends have generally been disappointing. We have had dry weather for the odd vide grenier, but it tends to rain in the afternoon.
So the grass is fast approaching my waist, the cow parsley is bigger than I am, and through it all there's not a butterfly to be seen. Today I saw a few bees around the blackberry and hesperis, but that's about it.

Can this bee spell?

 

Orphaned works?

You probably noticed the not-so-subtle message embedded into the photos. Would you like me to knock up some PHP to apply a message like that to every photo on my site? Would you like everybody putting images online to do the same?

A photograph, text, video, or other original content has copyright. This is automatic and does not need registration in Europe (it shouldn't in America but their legal system is so shonky that registration is recommended). That content, say, a photograph, may or may not have value. Value is determined by the market and by the person holding copyright.
The idea of saying that a photograph can be used by a commercial outfit without bothering to give attribution and little in the way of recompense to the photographer makes a mockery of the idea of copyright. The rumbling of the EU legislative machine is for non-commercial use at this time after a brief attempt at a search (ie, look it up on Google), but Big Media (you know, the same ones that want to extend their copyright to be a criminal act, and for it to cover a work for longer than an average lifespan) are lobbying hard to get the orphaned works privileges extended to them as well.
This means a photo you take could be the front page of a national newspaper. And you? Won't get a mention, probably won't see a penny. As it is an "orphaned work", you can even try arguing wilful infringement. Well, you could, but it'll cost you in legal fees until the sliver of chance that you win. The system would be set up to work against you. All that needs to be done is to have the attribution stripped and it can be called an "orphan work". Seriously.

There is a general rule - if a work does not explicitly state that it is in the public domain (either in those words, or an understood licence such as CC), then somebody somewhere holds copyright. In the majority of cases, it is no big deal. There are some images around here that are not my own making. I'd be happy to add credits if I knew who, or take down upon objection. Their use here is a part of a whole to hopefully benefit you, the reader. No monetary value is assigned, inferred, or anticipated; not in the images or the accompanying text. I believe many content creators would be okay with this, just as I don't get ruffled feathers if somebody wishes to use one of my photos in their blog. If, however, our content was deemed "orphaned" and then used commercially, I think we'd all agree that this is a bit naff. How about photos of your kitten adorning the side of a pack of crunchies with you getting nothing in return? Maybe that photo your boyfriend took when you were drunk actually looked pretty good, the bottom half now features in an advert for tights on big billboards.

It is easy to "create" an orphaned work. Moreso with images where a lot of editing software throws away metadata (primarily due to not understanding/supporting it). This should not be used to get around the concept of copyright and what is considered acceptable use of content. This is not a case of "all your pictures are belong to us".

Or, to put it another way - as the embedded text says - if this comes to pass and big media does not take our copyright seriously, why the hell should we continue to bother taking copyright seriously, at all?

 

Your comments:

Rob, 11th June 2012, 17:14
Oh tell me about it. Back when we sold on eBay, we had pictures used by others... It got to the point I wrote a script to add a watermark to every image when it was pulled from the website. I'm considering doing the same again for www.viewdata.org.uk.
Rick, 11th June 2012, 18:10
Ah, but we are entering into a different territory - not one of using your imagery, but one of using your bandwidth. In essence, you are paying to promote their junk.
joe, 12th June 2012, 03:26
Hi Rick, what sort of bee is that, I've never ever seen 
such creature in my life, I had a beehive full of bees 
about 10 years ago, none of them even resembled this 
thing. 
I had to give up the beekeeping idea after the first swarming and complains from my neighbors, you can do it if you live far away from populated areas, some new hobby for you, Rick.
Rick, 12th June 2012, 05:16
BeeErrr... It's fuzzy and buzzy. That's about the limit of my knowledge of bees. Actually, this one has a big long snout so it can poke into the heart of the flower, which you can see in this photo (I didn't use it originally due to it being slightly out of focus). 
 
I think you'd have to be kinda suicidal to contemplate starting up with bees these days, what with the Varroa mites and colony collapse (I don't know about Aus, but it is disturbingly prevalent in western Europe). 
 
By the way, you don't need to press Enter at the end of each line of comment, it'll wrap. ;-) 
Rick, 12th June 2012, 05:29
Follow-up - using the "bee with long snout" description, I found it pretty quickly. It isn't actually a bee, it is a "bee fly" whose larva live in bee nests feeding on the bees. Sucks to be a bee... 
 
http://www.wildlifeinsight.com/Insight/?p=3710 
http://en.wikipedia.org/wiki/Bombylius_major 
 
Here's a damned-impressive picture. Tell me this doesn't look like something out of The War Of The Worlds? 
http://barry.fotopage.ru/gallery/files/19/CRW_4595_1.jpg 
Rob, 12th June 2012, 23:02
Nice find on that WOTW picture :-) 
 
Back to pictures; yet we suffered both sorts. Most recently I had bandwidth theft though - that, at least, I can spot through the logs.

Add a comment (v0.11) [help?]
Your name:

 
Your email (optional):

 
Validation:
Please type 19403 backwards.

 
Your comment:

 

Navi: Previous entry Display calendar Next entry
Switch to desktop version

Search:

See the rest of HeyRick :-)