Programming the Brick in asm or C

This is where you talk about the NXJ hardware related topics such as the brick, sensors, LEGO pieces, etc

Moderators: roger, 99jonathan, imaqine

Programming the Brick in asm or C

Postby Tickstart » Tue Oct 11, 2011 6:09 pm

Hello, I have a question for those of you who have made this whole thing possible.. Obviously you must have learned to program the ARM7 in at least C, and probably in assembler.. So how did you, you know.. Get on with it? How do you start? What is the interface between the brick and the different peripherals, do you specify a voltage and current to a port or whatever? I'm currently studying to become a computer scientist and I want some applied knowledge you know, especially if it involves lego :D
thanx
Tickstart
New User
 
Posts: 11
Joined: Tue Jul 12, 2011 4:39 pm

Re: Programming the Brick in asm or C

Postby gloomyandy » Tue Oct 11, 2011 10:25 pm

Hi,
Reading this thread:
viewtopic.php?f=7&t=2915&p=14318&hilit=firmware#p14318
Would be a good place to start. In particular reading the leJOS source code and the Atmel documentation should help. Be warned though it can be a little tricky if you are not familiar with hardware and embedded systems...

Andy
User avatar
gloomyandy
leJOS Team Member
 
Posts: 3004
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: Programming the Brick in asm or C

Postby Tickstart » Wed Oct 12, 2011 10:25 am

Thanks a lot Andy, one last question though; is there any chance I might "brick" the Brick? So that I can't flash it back to Lejos if I can't be bothered anymore?
Tickstart
New User
 
Posts: 11
Joined: Tue Jul 12, 2011 4:39 pm

Re: Programming the Brick in asm or C

Postby gloomyandy » Wed Oct 12, 2011 11:04 am

Well I can't say for 100% this is a fairly complex bit of hardware and there is always the possibility that you may damage it in some way. But I've never seen any indication of anyone managing to do this with an NXT... Just don't blame me or anyone else if you do manage to become the first...

One final bit of advice. Takes things very slowly. Once you have working code, only make small changes and test them often. That way it is easier to work out what may have caused a problem. You may be tempted to make large changes, and just add this extra change before you test it, but when things go wrong you will regret having so many possibilities to understand and debug... An embedded system is a hard beast to deal with. Unless you have ICE and JTAG debugging tools you are basically back to using printfs in your code (and with an embedded system when things go wrong you may not even be able to see that output, remember the display only works if you get your code right), if you are not familiar with this style of debugging (some of us grew up having to do things this way!), then it can come as a bit of a shock...

Andy
User avatar
gloomyandy
leJOS Team Member
 
Posts: 3004
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: Programming the Brick in asm or C

Postby Tickstart » Wed Oct 12, 2011 5:23 pm

Thanks man, that style of debugging sounds familiar :P I'm kind of writing a very primitive kernel for the MIPS architecture at school, like, getting three different processes to get along and not disturb each other.. So i know how the most simple of tasks can be f*ing frustratingly error prone..

But anyway, do you use makefiles or how does it work, say, you plug the nxt into your computer.. Then what? Do you have to write your own drivers and shit? I don't really know how to begin with this, in school we have a program that emulates a MIPS processor, and you write the code in a .s-text document, compile with make, and then it just works (well, at least the compilation works :PP) ..
Tickstart
New User
 
Posts: 11
Joined: Tue Jul 12, 2011 4:39 pm


Return to NXJ Hardware

Who is online

Users browsing this forum: No registered users and 0 guests

more stuff