About Me

Michael Zucchi

 B.E. (Comp. Sys. Eng.)

  also known as Zed
  to his mates & enemies!

notzed at gmail >
fosstodon.org/@notzed >

Tags

android (44)
beagle (63)
biographical (104)
blogz (9)
business (1)
code (77)
compilerz (1)
cooking (31)
dez (7)
dusk (31)
esp32 (4)
extensionz (1)
ffts (3)
forth (3)
free software (4)
games (32)
gloat (2)
globalisation (1)
gnu (4)
graphics (16)
gsoc (4)
hacking (459)
haiku (2)
horticulture (10)
house (23)
hsa (6)
humour (7)
imagez (28)
java (231)
java ee (3)
javafx (49)
jjmpeg (81)
junk (3)
kobo (15)
libeze (7)
linux (5)
mediaz (27)
ml (15)
nativez (10)
opencl (120)
os (17)
panamaz (5)
parallella (97)
pdfz (8)
philosophy (26)
picfx (2)
players (1)
playerz (2)
politics (7)
ps3 (12)
puppybits (17)
rants (137)
readerz (8)
rez (1)
socles (36)
termz (3)
videoz (6)
vulkan (3)
wanki (3)
workshop (3)
zcl (4)
zedzone (26)
Friday, 15 January 2010, 13:02

Interrupted train of thought

So i've been trying to get interrupts working on my beagleboard since yesterday ... bloody hell what a hassle. First I was trying to get a 1Khz clock going but not having any luck I switched to getting the vblank interrupt going. Of course, writing to the registers properly rather than using the offset as an index to an int * went a long way to making progress there. Damnit I keep doing that, envisioning each array access as register indirect with offset, when it isn't quite that. Yesterday I didn't make much progress - the busy workers, the noise, and the ungodly early start to the morning kept me from being able to concentrate on anything too much.

But even after working in it most of today ... it still isn't there. I (finally) get the interrupt ok, but then it never turns off and instantly returns once it's finished. Well either that or causing random crashes in the non-interrupt code. So some problems with the interrupt handler somewhere itself - like clobbering registers - as well as the way it's talking to the hardware (I'm clearing the interrupt everywhere i've discovered it needs clearing - the DISPC and the INTC). Might leave it for the weekend and see if a fresh mind doesn't help.

Oh, I also ran across some curious behaviour with the assembler and/or linker. I had some code intermixed with some constant strings. The code following the strings was all messed up, it was being written to non-aligned addresses (which is wrong for ARM). And even when I fixed that up with a .balign pseudo-op, the memory references within the code were wrong. e.g. a function call jumped to the wrong address - out by 2 bytes. Moving the strings after all the code segments fixed everything up. *shrug*

The A/C got installed ok yesterday - well eventually. The ceilings turned a 3 hour job into a 7.5 hour one. Although I think some of that was just throwing the installation guys off balance a bit. Well, it's all done now. Nice too - managed to sweep away all the stale smelly air in a matter of minutes, which was a nice bonus ontop of the cooling. Now I just need a good stretch of hot weather to test it properly. February is always guaranteed to oblige with that, and is just around the corner. Also cleaned up some of the wood in the yard from the photo in the last post. Not that you'd tell if I took another picture now.

Just went out for a few drinks and was hankering for a pizza on the way home. Nearly dropped by the local joint but needed a wee more than some baked fat. So being the tight-arse hermit I am, I thought i'd make one up rather than venture back into the wilds of the night. I also wanted to try and use some chapati as the base. I've been too lazy to make yeasted bread lately, so chapati has been a bit of a staple when I felt the need for some bread. Had some frozen sauce left over from earlier efforts, chucked on some bacon, cheese, onion, capsicum, chillies and even some thinly sliced squash (i'm drowning in the damn things), bung it in a hot oven, and bob's a dead cousin.

So for something a bit different, here's the chapati recipe I use, although there's not much to it:

Mix together till it forms a dough. Knead for 10 minutes. Rest for 10 minutes wrapped in glad wrap. Break off a 3-4cm ball and roll out flat with a rolling pin to about 2mm thick. Cook on a dry medium-to-hot frying pan or hot plate for 1-2 minutes per side - until it dries out on top and goes dark on the bottom and puffs up a bit. Dough can be kept in the fridge for a day or so until needed, so it's 'single friendly' - it gets a bit tougher which makes a stronger bread too. This will make 6, and they are very filling (each one is approximately equivalent to 2-3 slices of typical wholemeal bread).

The cooking and how thin you roll it is tricky to get right. I've had everything from crunchy `salada' biscuits (which gave me an idea, might try making crackers one day) to something very like naan bread (much preferable with a typical meal). If you cook with some oil it turns it into a sort of fried pastry/tough pancake - tastes great but just has to be bad for you. I've also tried using a pasta maker to roll the dough, if you don't mind it not being round. The layering you get if you keep doubling and running it through the machine also alters the result (don't go too thin of course). It's supposedly possible to have it puff up like a balloon if you finish over a hot flame, but I've never managed it.

For the pizza I undercooked it a bit since it was going in the oven as well, but cooking it a bit first made it a lot easier to handle and put on the pizza stone (something I never managed with bread dough without using baking paper).

Tagged beagle, cooking, hacking, house.
Wednesday, 13 January 2010, 23:34

Then a bomb went off.

Finally got out in the yard late yesterday, and this:

became this:

What a mess. Fortunately it was easier than I had anticipated, it only took a couple of hours for all that destruction. The posts were just sitting in the ground so they were pretty easy to remove.

Actually that first shot is from before I removed all the paving and dug the foundation trench for the retaining wall, so it's more like a weeks work between photos (or 6 weeks realtime ;-).

Getting a ducted evapourative a/c installed today - was originally penciled in for Monday so I would presume the guys are quite happy it is a nice 25 today rather than 42. Although they're not that pleased the ceiling is a very old style plaster type, which they didn't quote for, but I guess that's what the salesman gets for being too busy to visit the house first. Looking forward to getting some fresh air through the house, and during the last heatwave having the split system running all day was both expensive and dried the air out to an uncomfortable degree. And it'll be nice having the bedrooms all cooled too.

Tagged house.
Wednesday, 13 January 2010, 02:18

Roar.

Hmmmm, well I was wrong about why newlib was crashing. It's because the 'loader' is just executing the code in place, and the default linker script (that i've modified slightly) was re-aligning the data segment load address, but not the file offset. So again the data wasn't aligning with where the code expected it (rodata was still, which was confusing of course). For now I just removed the realignment of the data segment and yay, libc now seems to work.

It was still crashing in C++ though.

And of course, I downloaded the wrong version of the toolchain, so I didn't have the source to go looking through. But while it's downloading the right version I poked around on the cvsweb interface for newlib and found the right bit of startup code anyway. Ahh, missing a call to _libc_init_array.

Still crashing.

Hmm. At this point i'd developed the exception handler to dump the registers and some of the stack and was looking at finding out where in the C++ code it was crashing, so I recompiled with no optimisations and debug on. Damn, now it started working!

Mostly at least. Something is still wrong with bss in it or something - every time I compiled it it displayed using a different zoom/shear/rotations. Although if I set those explicitly, it all works fine.

Not terribly fast - every lion takes just under a second to render.

I've identified that the C code can't be compiled with optimisation -O2 or higher, so assuming there's no compiler bug, there's something in the dodgy setup code that's out of whack (C++ is compiled with O3 fine, but it isn't doing any of the hardware banging). But that doesn't surprise me in the least (missing volatile's and the like), and for now it can stay being unoptimised.

I've kinda forgotten why I wanted to render 2D polygons in the first place. I think it was to avoid storing big bitmaps, but using C++ seems to drag in stdio (for exception reporting) which blows code size out to about 200K anyway. Might be better off with a small PNG decoder instead.

Tagged beagle, hacking.
Tuesday, 12 January 2010, 05:30

Interrupts and exceptions

Yay, the weather finally turned. By the end it was just getting crazy - I'd accidentally left open a window in the house all day (or for a few days) and half of the house must've been 35 or more. Didn't think it was worth cooling it down - I just barricaded myself in a smaller part of the house with separate ac. A bit of rain too, not really enough but it'll do.

Should've got out digging in the yard this afternoon once the rain stopped but instead i've been poking around trying to get some stuff working on the beagleboard. I was trying to get AGG to render some stuff - but it's C++, and I don't really know enough about the execution environment of C++ to get it to work. But not even malloc() works in C, so for now i'm just trying to get that working (it uses newlib, and it crashes before it gets to calling sbrk()).

Since all I was getting was at best a silent death, I figured I'd work out a little about exceptions too - at least find the address of the crash. I misread the bit about interrupt vectors at first and spent a lot of time chasing that down ... I was writing a vector of addresses to the interrupt vectors, but it's actually a jump table. I found this out early on but forgot to fix the code and went off on a very long-winded goose chase trying to work out what was going on after some mis-direction from the mailing list archive. Well with the hot weather I hadn't been getting much sleep, so perhaps there's an excuse!

Well it told me it was crashing in malloc - but i knew that already. Can't easily figure out what's going on without source (it's something to do with static intialisation), so downloading the newlib source now (actually the whole toolchain), which is gonna take forever since I blew my quota.

Tagged beagle, hacking.
Friday, 08 January 2010, 10:44

Limited success.

Well I had some limited success on the DSI PLL clock front. I found some posts on the newsgroup and decided to look more closely at the kernel source too. Well I sort of got something working, eventually. Using the 72Mhz clock as the source for the PLL anyway. I dunno, it doesn't seem entirely right, and the monitor keeps dropping out every 20 seconds or so, so I might just leave it for now. At least I have a few of the bits needed.

I played a bit more with the matrix code. The snakey things move down the screen and react to things and bounce around like they should. The X-Y zappers move and 'zap' every now and then, planting a seed where they meet. Which ages and then drops off the screen. Even have a sequencer setup that describes the waves.

And I have screenshots! People like pictures don't they? Although it's only using putchar() as the 'rendering engine' at present!

This shows part way through wave 1, with the X-Y zappers just having fired.

And this shows a little later on - the attack ships and XY zappers have moved on a bit, the X-Y zap from the last shot planted a seed, and one of the earlier seeds have died and is currently falling down.

Bugger all code so far. Adding some user-controlled ship and bullet logic should be a doddle on top. Even played a bit with blender to draw some ships (actually I tried gimp first, but I really can't draw at all, not even slightly pleasant looking blobs), although implementing any graphics display is some distance off.

Now for another rant, sort of.

Since i've been back hacking for a while there's one thing i've really noticed. Boy is it much nicer developing using a GNU/Linux box than using Microsoft Windows (and that was XP, which is supposedly the best one). Ok this machine is a bit faster - quad core instead of dual, but the difference goes well beyond calculation speed. Everything is so much smoother and faster. I used to wait around for 30 seconds (I actually timed it) just for the friggan HELP to come up most of the time! Switching applications or desktops (using VirtuaWin) crawled. Even just using the browser ran like a pig after a few tabs were open. Pretty well everything I needed to do, every time i needed to do it, just seemed to illicit a groan of discomfort at the pain I was sharing with the CPU as it struggled to complete the task. I rarely even get the time on this box. And when it does take a while, it's usually obvious why.

Currently I have 5 x emacs, 1 x icecat (with 53tabs), 1 x javam (in icecat), 1 x blender, 1 x evince with 14 documents open (between 4 and 3500 pages long each), 1 x gimp, 1 x transmission, 1 x seamonkey (650MB alone!), 11 x xterms, 1 x xfontsel, 1 x gdb, synaptic, and even mythbackend recording tv as I type. The machine is using 3.5G RAM, and 1G of swap and has been up for 2 weeks.

Yet it just about runs like I just logged on.

Everything is snappy, and stable, I have all the tools I need at my fingertips - without having to use the mouse for every. click! little. click! fucking. click! thing. click! i. click! fucking. click! need. click! to. click! fucking. click! do. click! click!

Not going to enjoy going back to a windoze machine for work, if that's what I get lumped with.

Tagged beagle, hacking, rants.
Thursday, 07 January 2010, 12:42

Well that was a bit of a waste.

Blah. Spent hours and hours trying to figure out some of the clocking on the OMAP. My video output isn't quite correct at the moment - it works with my monitor, but it'd be nice to fix it. But I just couldn't get anything I tried to work. The documentation has strange examples which are a bit hard to decipher. I thought I managed to work out the programming of the clock it was using, but then the serial baud rate changed. Damnit. Tried using the other clock - and that took even more digging the documentation - but I can't get that to work either. The linux source is a bit convoluted but I might have to resort to working that that out to understand what's going on - the clocking system is pretty ... complex (there are dozens of clocks, with many cascaded from others).My new FSF membership card came in the post - or at least I got it out of the letterbox today. Bit thicker than i'd hoped - it's like a fibreglass PCB, so it might not make my wallet. The Trisquel installation is quite nice too - well setup, quite polished - everything just works. With a good selection of real applications too, like openoffice.org, gimp, inkscape, gthumb, and even evolution. Unlike some distributions with their weird application choices. Pity it's debian based mind you.

Hot again today - garden still alive somehow, at least the bits I remember to water. Getting a few (small) cherry tomatoes off every day - enough for a little salad. I suppose I need anything I can get to help my crappy diet lately. I even managed to get out for a bit - although it was just for groceries. Is it just me or are the roads a lot busier these days? Sigh.

Tagged beagle, gnu, hacking.
Wednesday, 06 January 2010, 09:37

gloat 0.1

I'm sure i'll live to regret this (i can already hear the glee of some kid discovering a buffer over-flow - well, in the unlikely event anybody ever downloads it), but i've uploaded my news snarfer 'gloat' to Google Code.gloat - it's a bit like brag ... err, geddit?

I'm going a bit loopy today. I was up till around 4am working on a 'matrix' clone (C64 - llamasoft), although now i've lost interest in it somewhat. And after a little mucking about in the garden have been solidly stuck behind my machine reading the net, manuals, and poking at bits of code all the way through till nearly 8pm - again. Well I had some lunch and coffee somewhere in all that.

Oh - it was too hot today to do much outside, but I suppose I should be using the weather to go to the beach or do some cycling or something I can't do all the rest of the year.

Tagged gloat, hacking, linux.
Tuesday, 05 January 2010, 07:39

Wrong UART

Well I got serial output working - was using the wrong UART (should've read the docs before assuming UART1 - it's UART3). And Das U-Boot leaves it properly configured so the output function is only 3 lines of code.

Then I hit an issue as soon as I started to use static data - my code wasn't being loaded at the right address (which took me some time to realise, since the code still ran). I don't really know why it works but I fiddled with the Das U-Boot mkimage line and now it's loading everything to the right address - it should be loading at 0x80008000 but I need to tell it to load at 0x80000000 to make it work. *shrug*

I got sick of ripping the SD card out to setup a new 'kernel' image (and a little worried, the SD slot on the beagleboard isn't really designed for repeated use), so I rigged up a rather nasty `runscript' (from minicom) script which uses ymodem to upload the image whenever I reset the machine. While the image is small this makes the testing cycle pretty easy. Just need a serial port thingy for my workstation and then I wont need the laptop anymore either.

Also along the way I wrote up some basic graphics output - just to clear the screen and display text, including a simple printf type thing. I converted my favourite font 'fixed' to a c file and can now dump text to the framebuffer. Originally I just wanted it to get some debugging output since I couldn't work out what was up with serial, but it's still handy to have.

And lastly I had a bit of a play with the DMA engine. And after a LOT of mucking about, finally got it filling rectangular regions. I couldn't for the life of me work out why double-indexed DMA just did nothing - in my haste to avoid reading the docs too closely I missed the bit which says exactly how it calculates the next address after a 'frame'. I had the alignment mucked up so it did absolutely nothing. If nothing else, it can be used for a very basic 2D accelerator - 90 degree rotations and flips, rectangular moves/copies, solid colour fills, and even masked sprites (colour keyed). So now my 'random filled box demo' runs a lot faster than it did before - around 10x actually (not that it was particularly optimised or anything).

I did some research on USB. Man what a mess that is. A few books i 'found' on the topic were useless too, just written from the perspective of windows driver writers at best (when a book uses 'visual basic' for 'portability' you know there's something very very wrong). I found some USB host stacks but they're proprietary, GPL2.x only, or BSD + advertising clause. And in any event tightly coupled to a given OS (as they must necessarily be). The Haiku one is at least X11 licensed, and clean and simple, so apart from being C++ might be the place to start if I decide to hurt myself one day with that pain in the head.

Hmmm, perhaps interrupts next, will have to get my hands dirty with assembly at some point.

Tagged beagle, hacking.
Newer Posts | Older Posts
Copyright (C) 2019 Michael Zucchi, All Rights Reserved. Powered by gcc & me!