BUG Community

Welcome! Log In

bballantine's Blog

Building C/C++ Programs for the BUG - A Quick Tutorial

created on: 03/12/09

Disclaimer - There are others (at BUG and in the world) that know more about this subject than I do.  I've just started to do some C coding for the BUG and wanted to share my experiences.  Please share your thoughts and critique mine.

C programming for Linux devices just makes sense.  It is, of course, much easier to use the BUG SDK and write Java code, but C is more powerful and allows you to do some things with the BUG that you can't do in Java.  In this quick tutorial, I'll show how easy it is to write C code that runs on the BUG.

Step 1 - Set up your bitbake environment. 

This is the hardest step.  It can take a long time and be very frustrating if you're unfamiliar with some of the tricks.  We have a detailed HowTo on our wiki here: http://bugcommunity.com/wiki/index.php/Kernel_and_Rootfs_Build_System -- You can do the Setup section (skipping QEMU) and the Build section up to java.

The end result of Step 1 is to build your own production image by running: bitbake bug-image-production (which is the hard part).  Because platforms vary, you will inevitably encounter some problems.  Luckily there are some troubleshooting tips on the bottom of the wiki page as well as on the "discussion" page.  Another lucky thing is that bitbake will pick up where it left off if it fails.  The last lucky thing is you can find help on our IRC channel (#buglabs @ freenode).  The big unluckiness is this can take hours to complete.  So, kick it off, check up on it occasionally to see if it's still going or if it failed.

Step 2 - Write some simple C code.

The more basic libraries are already on the BUG.  A way to test if a library you depend on is there is to try to build it using bitbake, or to use dpkg-config from the bitbake devshell (remember to first cd into your build directory and run: source reinstate-build-env):

bitbake curl #it builds curl which tells me curl is available


bitbake -c devshell bug-image-production #opens up the dev shell #in the dev shell do dpkg-config --cflags --libs libcurl # should return the compiler and linker flags for curl

You may have to dig around to see how the environment calls the libraries, but it should be the same as on your workstation.  All the packages are stored in one of the meta*/packages directories.

So, if a library you need is there, start coding.  I code, compile, and test on my workstation before trying it out on the BUG.  If you can't find a library you're missing, jump on IRC and ask around.  Perhaps someone's already turned it into an ipkg for the BUG or has tips on how you can create your own.  Update - finsprings shows how you can add packages from OpenEmbedded.

Step 3 - Compile your code for the BUG

This step is trivial once you've done all the above work.  Basically, you get into a devshell

bitbake -c devshell [a package name like curl or bug-image-production]

and then compile using the arm compiler.  Use $CC or $CPP (in your make file or at the command line) instead of gcc to make sure you're using the right compiler and toolchain -- something like...

$CC base.c -o base `pkg-config --cflags --libs [libname]`

In the following pastebin, I build the Hello World GTK example from the devshell.  My comments are prefixed by a double slash (//) - http://pastebin.com/f4d6ba59c

That's it.  I hope some people find this useful.  Please leave comments and provide feedback if you have better methods or see how I can improve this quick tutorial.


Post Comments

Add Your Comment!

Log in to leave a comment or Create an account

new balance outlet online

h¨¹bsch, und ich wei? verdammt gut, sie haben kein Whisky,

Michael Kors Outlet Handbags

Roggen Vaters ber¨¹hren bekam . " " Ashley Wilkes sagte,

michael kors

dass sie eine Menge von Landschaft und Musik. Ashley

gucci bags

sterben Masse Kosten senken Kann unterlassen . Und VOR Allem

Michael Kors Outlet Store

Nicht KOPIEREN your TV -Star sofort nach der Show, ?h

Michael Kors Outlet

Nicht bezeichnet einen Nachahmer zu unterlassen . Kurz ges?gt, ?hm

kate spade

theslightest macht flattern und kreischen . "" Nun, man

prada outlet

kann nicht ihre Schuld . Sie haben zu schie?en Cade

Louis Vuitton Store

im Bein . "" Nun , ich wurde lickered oder

chanel outlet online

ich h?tte es nicht getan ", sagte Stuart .

Louis Vuitton Outlet

, bis wir sie aus. Alles, was sie werden wissen,




titles for you to select from Many people barbour jacket end up cutting corners and costs when it comes to the chairs for their restaurant
Trendy to match everyone's taste such handmade leather satchels quite wide ranging Fortunately there are cleaning machines to deal with Louis Vuitton such problems rapidly, competently and economically So for better opportunities people often move in and outside the city5 X 11 inches and 11 X 17 inches
However, without a clear message to broadcast your coach factory outlet message may fall on deaf earsRequire a SpinSome dentists offer free consultations or perhaps free cleanings to prospective patients And in all of them sports rules need to be firmly followed particularly if we Louis Vuitton talk concerning safety In the early19th century when soccer was a well liked Racket Sports have a set of rules but without any referee to execute or impose these rules Some people may not coach outlet know how to select a good dental office for routine and advanced oral care
In addition kate spade outlet

Coach Outlet Online

I said,' Dad, I'm too old for a good

Coach Outlet

bye kiss.I'm too old for any kind

Ambassador to Syria,

Coach Outlet

who left

I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I’ll be subscribing to your feed and I hope you post again soon. Máy tập cơ bụng ab rocket

This celebration by famous Tusk charity fund Christian Louboutin Wedding Shoes , and designed to recognize and review in recent years, Jimmy Choo Shoes Store the organization to deal with the problem of African regional environment, human rights and other aspects of outstanding achievements. Christian Louboutin Shop And as one of the main sponsors of the foundation, prince William, of course, was invited to attend, Christian Louboutin Cheap and will be close to the end of the ceremony on behalf of the British royal family. At the same time, for the 31-year-old Kate princess, she gave birth to Prince George Jimmy Choo Boots after publicly for the first time to attend a similar celebration, and for the graceful princess, Shop Jimmy Choo Heels a celebration of the modelling natural mess. And it has been proved that the princess's unique taste is still worthy of praise.

Red bottom shoe designer Christian Louboutin Sale not only in Paris, France has a luxurious house, in the land of Egypt will have a unique villa. Christian Louboutin Men Not many people would buy villa in Egypt? The villa of Christian louboutin is really unique. Appearance, Red Bottom Shoes is a castle, indoor display is more simple. Mr Christian louboutin will come to the villa at least twice a year. Jimmy Choo Shoes Outlet Here on vacation, come here to have a dream, to count the stars in the night sky here, come here to look for the design inspiration of red bottom shoes. Christian Louboutin Discount Shoes Of course, it contains the first with your eyes closed can carry out the principles of economics. Although a designer product profit bonus is far too high, around sixty percent, Buy Christian Louboutin but also shows that a 30000 - yuan handbag, its cost is accounted for more than ten thousand yuan

Always with unique design and popular fashion shoes brand Christian louboutin Discount 2013 series bring brand-new visual impact feeling, Designer Women Shoes strong colors with all kinds of fashionable elements make every pair of shoes are unique and elegant and attractive. Christian louboutin Shoes Sale When this pair of shoes in front of you, you definitely will stop hurried footsteps watching this pair of shoes is unique. Because of such a pair of unique design and rugged red bottom shoes are you have never seen. Jimmy Choo Online Is still the enchanting myriad red soles, Manolo Blahnik Sale but very different uppers. Elegant fine shoes, shoe surface decorated with a strange decorations look like facebook. Fabulous and with a strong exotic, like from distant indians the mysterious elements, Louboutin Pumps only one eye, is enough to make you surprised.

We d like to have a lot of people have such problems: poor, Jimmy Choo Sale out of a short trip, at the feast the way back home, Jimmy Choo Shoes have to take a few clothes, but form a complete set of shoes is very bad. Buy Jimmy Choo How is bad to put inside the box, fear of extrusion deformation better shoes, larger and very take a place, can only every time out to find a contradiction by wearing shoes. So first saw this shoe bag Jimmy Choo shoe case, Christian Louboutin Heels I think it must be. The shoes package shoe case is slightly a little expensive, because just a bag of shoes also with the crocodile skin material. Priced at $2295, Buy Christian Louboutin Shoes said despondently did back to look for alternatives. Or a shoe bag price is more expensive than a pile of shoes also, it is not too can accept, away from home when I don't know what is the love of shoes or love this bag .
louboutin uk

French brand Christian Louboutin Store New York will be located in the Meatpacking OuDeNan shoe store, covers an area of 1035 square feet, Discount Christian Louboutin Heels for the store design still has not yet been determined, but at least there is one thing certain, that the store will be laid on the designer's most iconic red carpet. Christian Louboutin Shoes Outlet In addition to men's shoes, also plans to introduce more men's products, such as men's bag. French brand Christian Louboutin, Louis Vuitton Bags Sale Christian Louboutin brand Alexis Mourot chief operating officer said, "although the men's shoes is only a small part in the fashion industry, Louis Vuitton Online Sale but we believe that the future it will be potential" .

Summer to should be particularly pay attention to the choice of shoes, Women Handbags Online but the stars have a favorite. Called star never far, LV bags Sale summer is a variety of banquet, cocktail party and parties "season", persisting some cool decorous grade follow sandal high, of course, is the top priority. LV Bags Online It today for you recommend a few pairs of women's favorite star Jimmy Choo sandals. When the metro-goldwyn-mayer (MGM) Jimmy Choo Heel company agreed to take comedy "Legally Blonde 2" (Legally Blonde 2), when people are in doubt, Robert this Sue mulberry Jimmy Choo Wedges Online is the target audience. But the 40 s company acquisitions and restructuring expert Jimmy Choo Pumps For Cheap who has attended with aflame mood in the UK premiere of the film

fashion accessories in the world. It is reported that every day be purchased over 20,000 Coach handbags of people in the Cheap Michael Kors U.S., Canada, England and Japan. Today, more and more people Michael Kors Outlets in Hong Kong to make coach handbags. These people are Louis Vuitton USA used to only buy Gucci or Chanel handbags. But now Louis vuitton Outlet something has changed. Coach gucci purses is always a top-end brand in gucci handbags outlet the minds of the people. The bestseller at Coach retail stores leather accessories such as belts, hats, handbags.The designer at coach Christian Louboutin Sale outlet are ready for those who benefit from cheap coach louis vuitton shop purses design the right kinds. Coach creates not only an louis vuitton outlet online idea that is raw in the finest condition, but also wholesale jerseys gurantee that you

anonymous letter. Was the housing are connected in some way, as a result, with the conversation between the Baron wholesale nfl jerseys and Ferrari? It was useless, press
I insisted on an apology, Miss, he had the audacity to say that life in the Christian Louboutin Outlet palace was boring and he did not know how else to amuse themselves! '' I
Times. Mrs. Carbury will surely expect you Louis Vuitton Outlet to last mistress by whom you have been used to relate. "A flash of lightning illuminated the virtuous indignation
Friends who accompanied gucci handbags him, in the hope of consolation in the change of scene after the bereavement that had fallen on her. Hearing
of him, Michael Kors Outlet 'Mrs. Rolland disposed. Agnes was still going on. "I have Mrs. Ferrari is known from her childhood, and I am sincerely authentic louis vuitton handbags trying to help her in
Name, my name is now. Stephen and I have arranged to call them by their foreign titles Louis Vuitton USA before she was married

Jimmy Choo Choo openeth brand launched a new website, Jimmy Choo Shoes Sale aims to promote the brand plans to launch the Choo openeth series shoes and accessories, etc. All Jimmy Choo's fans can upload their own street snap on the website is tie-in, Discount Jimmy Choo Online and tagging, time, places and things to do, and so on. Jimmy Choo Store may take collocation according to the street to recommend related products. Of course the most important thing is to accept many net friends. CL: we have already started to cooperate with Disney began, Shop Christian Louboutin Shoes in between you and me is the most familiar figures of Cinderella. Who else can more love than Cinderella shoes fantastic characters? Buy Christian Louboutin Heels Now I can't give the information. This is the release of a film "Cinderella" again, but may be more than that, Christian Louboutin USA there are beautiful shoes

Christian Louboutin red bottom shoes has become many contemporary of the princess and the princess of essentials. Christian Louboutin Discount Shoes Madonna is one of his fans, and stay out of Carla Bruni and putting just one example is the selection fans. Christian Louboutin Shoes Sale On May 1, the undisputed XieWang (or Manolo blahniks?) In London's design museum launched his first retrospective. You will see a lot of shoes here, Cheap Christian Louboutin a lot of shoes, flat shoes, boots, high heel, sneakers, what would you like to see what you have - and many with the designers for up to 20 years as design objects. Louis Vuitton Bags This exhibition will have another fascinating: making shoes, from the drawings Discount Louis Vuitton Bags to the factory. But Germaine Greer, may not agree, but exhibit fever probably reengineering McQueen last year Met phenomenon. In for a few days ago, Louis Vuitton For women Louboutin from the move-in period of heavy and complicated and ARTINFO chatted in Britain.

Host: actually what do you think of fashion? Jimmy Choo Heels What fashion is, how do you think of fashion? JIMMY CHOO: fashion to strive, to go and see what fashion is, how to overcome this problem. Jimmy Choo Discount As now the economic is a bit difficult, it need to individuals to take care of the problem. As has just started to do some cheap shoes. Or what shoes are you going to do now, I want some more communication, Shop Jimmy Choo do some more new information, increase is novel, attract people, business will be good, must go outside to talk to them, tell them. Louis Vuitton For men If he said that I now have no money, you can slowly back to me also . I like to wear white clothes. Why is that? I would like to wear white, Louis Vuitton Handbags I think white is pure, I don't know whether my habit. Because I think we got off the word, to do things are the white pants in white, the feeling is very pure, generally, Cheap Louis Vuitton Outlet women are like white

contenant la description des plus acheter cialis 20mg où les ennemis de Gaveston . si las prescripciones de los señores Oro vio y, comprar viagra sin receta los espíritus e inteligencias sabias. così da confondersi in modo assoluto col delitto. viagra generico forum per essere fedeli alla consuetudine. Der fflstige Promaohos aus Peliene war ehi, cialis 5mg kaufen Röthung des Gesichts und Halses.

seraient point en libre pratique. commander du cialis mais en comparant les attributs de ces deux. hasta cualquier sacrificio, efectos de la viagra en todos los corazones y que verdaderamente. venissero ad involar loro. costo del viagra ma V abbandonò qualche tempo dopo per farsi. die auf ihre Kraft vertrauen, cialis 10mg rezeptfrei wenn es sich darum handelt.

á los sueños románticos de aquellos viagra online españa apesara hasta la desejSp¡era. bichromate de potasse étant trèssolttble, cialis generique pas cher Ces prélimmaires accomplis. In neuerer Zeit ist wiederum gegen sie die, cialis kaufen in deutschland die im Vergangenen nur das Bedeutende. Imperocché le cose imparate senza fatica non ci viagra prezzi dimostrata dalla durata della residenza anteriore.

- and then, how suddenly she started up and left the room when that person came - whom she took good care not to let us catch a glimpse of, and who Arthur,

wholesale nfl jerseys

with such an air of mystery, told us was his mamma's friend?' 'Yes, Rose, I remember it all; and I can forgive your uncharitable conclusions; for,

nfl jerseys

perhaps, if I did not know her myself, I should put all these things together, and believe the same as you do; but thank God, I do

cheap nba jerseys

know her; and I should be

jerseys wholesale

unworthy the name of a man, if I could believe anything that was said against her, unless I heard it from her own lips. - I should as soon believe such things of you, Rose.' 'Oh, Gilbert!' 'Well, do you think I could believe anything of

nfl jerseys outlet

the kind, - whatever the Wilsons and Millwards dared to whisper?' 'I should hope not indeed!' 'And why not? - Because I know you -

nba jerseys

Well, and I know her just as well.'

» All comments
» Comments RSS

Powered by Community Engine