F/OSS for the PIC24? - embedded

I'm learning embedded programming with the PIC24, and I'm looking for something "real-world" to dig into to help me learn. Are there any free software projects that might be targeting to the PIC? Anything that I could help port, or a niche I could try to fill?

Quite old (2005) but may help you to start:
http://www.gnupic.org/
For example, gpsim at http://www.dattalo.com/gnupic/gpsim.html

If you are looking for software projects, look up gputils - is the open source assembler and linker, and sdcc - an open source c/c++ compiler (lacks a PIC24 port).
If you are looking for embedded projects, there is nothing specific that comes to mind. However, do visit the piclist to pick up code snippets and learn from examples. Some of the best PIC coders contribute there.
If you are looking for hardware projects, there are verilog PIC16/18 cores on opencores but no PIC24 cores yet.
So, there's plenty to suit all tastes.

Related

Starter questions on microcontroller programming development tools

I was recently assigned a micro-controller programming task. I will need to program on MKL05Z32VFM4 device.
I was reading some programming tutorials on Microchip Technology's MPLAB IDE X, because that seems to have the most information, but looks like that IDE is only for Microchip products.
What development tools should I choose for MKL05Z32VFM4? Are there a generic IDE and simulator environment? Are there some tutorials for me to start to look at?
I apologize for a basic question. I am a decent general software developer, but I am very new to this area.
(this post will be partly useless if you plan to use some commercial toolchain like Keil, IAR or sth like that)
For ARM Cortex devices you have quite a lot of options available (; If you're in a mood for a bit of automatic translation you could check my website - I wrote a tutorial about (open source) toolchain for ARM - http://www.freddiechopin.info/pl/artykuly/35-arm/59-arm-toolchain-tutorial - unfortunately it's not translated to English, so you'll have to use google translate. There are also some other resources that you might find useful, especially my template/example projects for such toolchain (in Download). If you ever used Eclipse, Makefile and GCC this whole subject should be easy for you. Most of example projects will be close to what you need, but you should probably check example for STM32 (any) - which is a Cortex-M3, and the example for LPC1114 - which is a Cortex-M0.
As for the simulator, I personally think they're not worth the trouble, recent GCC toolchains disable it anyway, as it's only instruction simulator, you won't be able to easily simulate peripherals. If you want to simulate instructions just write your code for PC as it will work the same way (; If you need to check something on the real hardware you can use GDB and JTAG. As long as it's not some extremely expensive proprietary design (you can - again - check my website for other options) the tools are almost free - OpenOCD (GDB Server) is open-source, and you can buy a FTx232 based JTAG (the most popular kind for OpenOCD) starting at ~30$.
Big commercial toolchains sometimes have simulators with peripherals simulation, but these cost a few thousand € / year (;
Google around for "ARM Cortex" with keywords like: toolchain, gcc, openocd, debugging, jtag etc. to find some articles - there's a lot of it in the network.
Your question is really general, so pretty hard to answer, as we don't know what tools are you going to use, are you planing to use some external libraries, what type of work are you going to do with these devices etc.
From my experience contact with embedded world is often a huge shock for developers of PC software. It mostly works the same, but because resources are constrained you really should do things differently. You don't have "+infinity" of RAM, you should usually try to fit a lot of things in ROM and so on. And of course there's only C and C++, but in C++ you shouldn't use some of it's features (exceptions, RTTI, iostreams, parts of STL, ...), dynamic allocation of memory is not a good idea generally (with the chip you mentioned - 4kB of RAM - it's out of question in my opinion).
The chip you mentioned is really tiny, so it will probably be a bigger shock (;
Try to ask some specific question and give some more details about your project so we could give more detailed answers (;
That's a Cortex-M0 device. You can find lots of information online. You can start at arm.com. As far as toolchains go, gcc and clang are both free and support ARM and will work fine. You can get ARM's tools too, if that's what you're into. JTAG for debugging is going to cost you - most people use ARM's in-house RealView debugger or Trace32 from Lauterbach. I've also used the BDI3000 from Abatron.
It looks like a Freescale MCU. Freescale's IDE of choice is CodeWarrior.
A good place to start is the part manufacturer's site, generally they will have tools or links to recommended third parties as well as application notes and libraries. Start at the Freescale Kinetis KL0 series "Software & Tools" page.
Freescale's own CodeWarrior tool is Eclipse based.

Atmel C compiler manual?

I'm just getting started with the Attiny84 on AVR Studio 5 (based off of Visual Studio). However, I cant find the C programmers manual for it so I can figure out how to write ISR's, address GPIO pins, etc... Any ideas where I could find the manual for it?
Just looking at the AVR Studio 5 web page, it looks as though it can use the GCC compiler--not sure what other compilers it might be able to use.
The GCC compiler is an open-source compiler used for many platforms, so documentation is available for that from many places on the Internet.
The other thing I could suggest is taking a different approach: start by looking at some publicly available code for the AVR. AVR Studio 5 is in beta, but I expect it wouldn't be hugely different from what has already been in use for several years (AVR Studio 4 etc). AVR Freaks is a good resource for looking at AVR code done by others, for a wide range of applications.
It takes a bit of hunting down, but according to this press release, the integrated compiler is GCC. The GCC documentation is at http://gcc.gnu.org/onlinedocs/ for all versions.
In the 4.6.0 release, AVR specific sections are:
3.17.2 AVR Options
6.37.8 AVR Variable Attributes
The Atmel AVR Studio 5 web page claims that it has several hundred example projects included, I am sure than many of them include interrupt handler examples.
So the official manual is located here (provided by Atmel Applications Engineer):
http://www.nongnu.org/avr-libc/user-manual/modules.html
It had all the information I needed to get up and running.
I too am just getting started with AVR Studio 5. When doing GPIO, interrupts etc, I think you will want to leverage the code already provided in the ASF (Atmel Software Framework). Under the Project menu use the "Select Drivers from ASF..." to select the pieces you need. Alternately you can load sample projects targeted for your processor. I found the AVR Studio screencasts on the Atmel site (they are also on YouTube) worth watching.

Decompiling Objective-C libraries

I've just finished a library in Objective-C that I compiled as a Static Library for distribution.
I'd wanted to know what chances to get this decompiled are out there.
Do you know any software that can do this?
If so, how could I protect me better?
EDIT: My static lib is made for iPhone / ARM
I created an algorithm that depending on the some parameters of the app, it can run as demo or as full code. You init the object with X variables and unlock the full version. I was wondering if they'll be able to see this algorithm so they can create a key generator.
If it executes, it can be decompiled. Objective-C is particularly easy to decompile into readable code thanks to its dynamic features. If you want to make things a little bit harder, you could write most of your code in plain C and strip the executable — which of course has the tradeoff of making your application design harder to manage. But be honest with yourself: If somebody wants to crack your code, you are not going to be able to stop them. Crackers have practically unlimited amounts of time and enthusiasm and will actually be excited by any novel efforts you put in to stop them. Nobody has yet made uncrackable software, and the biggest corporations in the world have tried. You're not going to do better than them, especially if you need to ask about it on Stack Overflow.
Take the time that you would have put into thwarting decompilation and use it to make your product better — that will have a much better ROI.
It's not clear what you are trying to protect yourself from. Yes, it can be reverse engineered. The simplest tool is otool, part of the standard developer distribution:
otool -tV <library>
From that they run up to things like IDA Pro, which has iPhone support and is very nice for this kind of work. In between, I'm really surprised that I haven't seen a rework of otx for iPhone/ARM yet. I wouldn't be surprised to see one show up eventually. And of course there's gdb if you're trying to work out how things flow and what the data is at various points.
If you have more details about what you're trying to protect yourself from, there may be some targeted answers. Beyond that, read Chuck's comments.
ChanceGetsDecompiled = ExpectedGainFromBeingDecompiled / PopularityOfLibrary
Well if you REALLY want to know I would try decompiling it your self. You don't say if this is for PPC, Intel, or ARM which makes a difference. Here is a decompiler for Intel
i386 Decompiler
I don't know what you could do (I don't think there is much) to limit this. Code can always be reverse engineered. Be happy that your not using java or .net. Their decompilation is so nice.

How Compatible is GNU Smalltalk with Squeak

I'm working on an app in squeak that requires no graphics at all, its all just data manipulation. The problem is that I work in a fairly conservative environment and I dont think I'll be able to sell a squeak app to my managers (I feel like the bright colors, round interface and general "what-the-heck-is-that" feel of squeak will scare them off). So I'm considering running the app under GNU Smalltalk, as a more "traditional" command-line interface is less likely to scare off stakeholders.
So, can anyone either provide, or point me towards, a list or set of what features/classes are or are not compatible between Squeak and Gnu Smalltalk. In other words, how hard will it be to port an app from one to the other (again assuming that its non-graphical, so no need to worry about morphic)?
Thanks!
I agree 100% with igouy; in addition to that, the main difference will be the filesystem classes. GNU Smalltalk's are more similar to what you get with Squeak's Rio package.
You can convert your code from Squeak to GST with gst-convert which will also take care of some of the difference.
There is an ANSI Smalltalk Standard (http://www.smalltalk.org/versions/ANSIStandardSmalltalk.html). Gnu seems to be a full implementation of the standard (see Gnu Wiki) and Squeak seems to be fairly compliant (see Squeak Wiki). So stick to the standard and you should do well.
The GST implementation will give you a much better answer than we can - so just try it - file out your code, and see what fails with GST.
I don't know how up-to-date the Rosetta "Cross-Dialect Smalltalk Code Interchange Tool" is but it might help.
Here are some minor differences that were leveled out to make things easier on the benchmarks game - GNU Smalltalk :: Squeak
When you hit specific problems ask about them on the GNU Smalltalk Mailing List.
In addition to the other suggestions, make sure your SUnit test cases are up-to-date; it's much easier to find any missing methods in GNU Smalltalk that your application is using that way.
Pharo looks more professional, and might help. Or if you have less than 4GB of data, Gemstone. A Seaside user interface looks the same as a ASP.NET MVC or Rails one, and can be created easier.

Is there any Subtext IDE or equivalent Example-driven Visual Programming Language/Interface published on the Internet?

I'm really excited about this new and experimental language named Subtext. But it's author haven't released nothing about it besides some papers and videos. Should I clone it? There are similar alternatives?
UPDATE I'm looking for an example-driven VPL, not just a VPL.
As Edwards' says in his related work section, the Self programming language is very similar. It shares subtext's emphsis on directness, uniformity, and liveness, but doesn't emphasize a tabular format (Schematic tables).
A lot of of work went into the Solaris version:
http://research.sun.com/self/papers/papers.html
seems there's a Mac & linux version, not sure how mature it is:
http://selflanguage.org/
Here's a video demo'ing Self, where they emphasize directness, uniformity, and liveness:
http://www.smalltalk.org.br/movies/
When you say "any VPL", do you mean none at all, or not a run-of-the-mill one? From the wording of the title question, I'll assume the latter. Here're a couple with some serious programming theory behind them:
Morphic is/was a/the UI piece of Self, and is now ported to Squeak:
http://wiki.squeak.org/squeak/2139
Prograph was a way-cool system, but I don't know of an available version.
A bit further out there is Kahn's Toontalk, based on Pictorial Janus:
http://www.toontalk.com/
I am sure you are aware of VPL On Wikipedia that lists many different VPL languages. You have not supplied information on what you are trying to achieve but another site is Synopsis. This is a commercial product.
From their website:
Synopsis is a completely visual RAD tool for Windows that frees you from having to write textual code and learning unnecesary programming details. With Synopsis you can concentrate on creating software instead of wrestling with mundane and complex low-level development tasks.
The image below shows how this application looks:
(source: codemorphis.com)
Granted my knowledge on this subject is limited and I do follow this to see if something really powerful can be created. I did see a project on CodeProject or CodePlex that was written in C# that allowed VPL but I cant find that URL.
If I ever do find that application I will edit this post!
You haven't provided more information about features you expect from such a VPL environment, but I think that "Tersus" could be interesting thing to look at. There're many VPLs, but mainly they're targeted as educational tools or addition to particular technologies (i.e VPL for Microsoft Robotics Studio) to simplify common tasks programming. The "Tersus" is full blown application development platform. It's open source and free to download for many OSes.
http://www.tersus.com
Coherence — The Director’s Cut
The Coherence home page is up at http://coherence-lang.org. The submitted version of the paper is there, with a new intro and a surprise ending.
Coherence claims to be an experimental programming language, a continuation of Subtext using other means.
Intentional shipped, but they are still kind of alpha, with limited distribution and testing. You can make example driven DSLs, but I don't know if the environment itself works that way.
http://lambda-the-ultimate.org/node/3287
You could look at the work on eve that is happening too:
http://incidentalcomplexity.com/