C two platform compiling - embedded

I want to run some C code targeted to run on a unique PIC micro based hardware setup in a PC windows environment as well. The objective is to emulate multiple instances of the hardware without the actual hardware. I expect to have to write the code upfront to account for this and to create low level functions in C or C# that emulate each of the PIC functions.
Does anyone know an environment that can support this?

What you're looking for is a microcontroller simulator. The simulator will run on the PC and execute the PIC code. In order to e.g. generate interrupts / simulate serial data / whatever you'll need to either configure the simulator settings or write a few custom function.
Your target code (for the PIC itself) shouldn't need to be aware of what environment it's running on.
Here's a few links, but you're best off searching for some variant of "PIC microcontroller simulator" or "microchip PIC simulator".
http://sourceforge.net/projects/gpsim/
http://sourceforge.net/projects/picsim/

I'm not sure that this question is about an instruction simulator. It seems to me that it is simply about the technique called "dual targeting". I've asked a similar question on StackOverflow before, please see: Prototyping and simulating embedded software on Windows . Recently, I've also made a blog post about dual targeting and rapid prototyping on Windows here: http://embeddedgurus.com/state-space/2013/04/dual-targeting-and-agile-prototyping-of-embedded-software-on-windows/ .
So, while the links should provide the answer to the original question, I'd like to add that the 8-bit PIC is probably no programmable in C++. In fact, it is so baroque that even C compilers for this "architecture" must cut many corners.

Related

Modern language IDE similar to QBasic?

I'm trying to find a modern environment similar to what I found great about QBasic but making up for the flaws. The purpose of this is to code with my 6 year old son.
I'm looking for an IDE that uses a modern language, has the ability to draw graphics and play audio, and doesn't force the User to jump around much between coding and running their application.
In QBasic you had basically two modes: Edit and Run. There were no third party libraries required for creating graphics or generating Audio tones (that I remember). You never had more than one "window" opened at a time.
Is there a modern day equivalent IDE which uses a modern language that provides what I'm looking for?
I don't want him to have to jump around between various windows, try to wrap his mind around window toolkits, understand the command line, or use OOP just to get started. My end goal is to create simple graphical games with him -- not printing text out to the console.
(Preferably cross platform or useable on Mac OSX since that's what we have at the house. Preferably Python based since that's my language of choice.)
QBasic is a great option. You can purchase an old PC from a thrift store and run QBasic on it. There is the option of QB64 which can run on both Mac and Windows. Hope this is helpful.
I'd suggest QB64, almost 100% compatible with QBasic/QuickBasic but runs on Windows.
You could maybe try Small Basic, it aimed to recreate the ease-of-use and educational purposes of the old BASIC languages build into home computers from the 1980s
The Small Basic project was initiated following this article on Salon:
Why Johnny can’t code (David Brin, 2006)

programming nRF51822 and integrating it on a PCB

I have a basic firmware question. I am looking to program a nRF51822 IC and integrate it on my own PCB. The evaluation kit seems to already have the IC soldered on it. Is it a way I can only program the nRF51822 and getting it ready to use elsewhere?
Get yourself one of these J-LINK LITE CortexM:
and hook up your connection header like this to your microcontroller (SWDIO, SWCLK, VCC and GND are the only ones needed):
.
Then, use Keil or nRFGo Studio to program your device.
You don't need J-Link at all. Any STLinkv2 board will work, like STM32 dev boards. But even nicer are these cheap Chinese programmers: http://www.aliexpress.com/item/FREE-SHIPPING-ST-Link-V2-stlink-mini-STM8STM32-STLINK-simulator-download-programming-With-Cover/32247200104.html
All you need to do is connect the Vcc, Ground, SDIO, and SWDCLK lines from your board/chip to the programmer, so make sure those pins are broken out and easy to get to.
There are some good instructions on how to do that here: https://github.com/RIOT-OS/RIOT/wiki/Board:-yunjia-nrf51822
I've built Linux workstations for workers on assembly lines to use with this method, and it just loops over and over for new boards. So they don't even need to touch the PC, they can just place a board on the jig or connect a header and it's all automatic.
You will need a programming device, such as a Segger Jlink. The eval kit has an on-board Segger programmer on it (that big chip with the Segger sticker on it).
I'm working through this process myself at the moment. I read somewhere that some people were successful at 'hacking' the eval kit, to bring the SWDIO and SWCLK over to their custom board but that really isn't the right way to go about it.
Instead, purchase an actual programmer and put a programming header on your custom circuit board.
While I am also still in the research phase here as well, it looks like there are 4-5 pins to connect from the programmer to your custom target board. The nRF documentation seems to be rather lacking in the definition of the programming setup, but look under the debugging category and take a look at Segger documentation as well.
If going into mass production there are ways to pre-program the chip before assembly, but I haven't had a chance to learn about that just yet.

How to program hardware? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I am an adept Visual Basic programmer. I wish to learn about how people program hardware. For example I have seen people create an LED watches, boxes etc. How do you achieve this? Can it be done using VB or Java? I have some experience in reading C, C++ code. I am only aware of IO in the C and C++ language.
Probably you are looking for a programmable microcontroller. If you have experience in C/C++/Java, checkout Arduino. Its chip is programmed using a C like language. This "How tos" page might help you get started. There are also some good books that will help you move forward:
Programming Interactivity.
Making Things Move DIY Mechanisms for Inventors, Hobbyists, and Artists
Wiring is a platform similar to Arduino.
Also have a look at the Forth programming language. There are lot of interesting "tiny
computers" that you can program with this rather unusual language. Here is a partial list:
Forth Inc
Greenarrays
Zilog Z8
PIC18Fxx2
Two famous Forth books:
Starting Forth
Thinking Forth (A classic in Software Engineering literature.)
how people program hardware
If by 'hardware' you mean a standalone device (an embedded system), then the process involves cross-compilation. Code for the device is written in some (high-level) language on a host PC, compiled, and converted to a form suitable for downloading onto the target device.
A cross-compiler generates executable code for a platform other than the one it is running on -- for example, an AVR cross-compiler will generate code for the AVR microcontroller, but the compiler runs on a PC. Universally, assembly and C are used, and to some extent C++, Java and Ada.
If by 'hardware' you mean some device connected to the PC via some port (serial, parallel, USB), then the programing involves interaction through that port, possibly needing a device driver as well.
Can it be done using VB or Java?
I'm not sure about VB (perhaps there are VB compilers for WinCE and its ilk). Java is used on more complex/larger embedded systems (eg. mobile phones), mainly to develop user applications for the device.
create an LED watches, boxes etc. How do you achieve this?
If you're interested in developing something like a LED watch, you need to learn how to program a microcontroller. At the least, you need two components: the microcontroller and some hardware which loads programs onto it (a programer). You may invest on a development board, or build one yourself. Naturally, you will also need the cross-compiler, and the sotware that interacts with the programer so that it can load code.
I'm partial to AVR, so I'd suggest that. Other options include PIC, some variant of 8051, PSoC1 and TI's MSP devices.
The AVR tool-chain is bundled in WinAVR, and it includes avr-gcc (cross-compiler frontend), avrdude (software that interacts with the programer hardware) and a C library (avr-libc) + a bunch of useful tools. Programing hardware can be as simple as DAPA/bsd to USB based ones (AVRISP, USBasp, Usbprog) etc.
Or, if your PC still has a parallel port, you can try to control say a set of LEDs using an application written in VB. Check http://www.lvr.com/parport.htm for details.
I would recommend starting out with something like an arduino, which is a good place to get started with programming close to the hardware. It's a prototyping board with some built-in leds and other things, depending on which model you get. You can use C/C++, or any other language which can be cross-compiled to a format which is compatible with the target hardware (ATMega microcontroller I believe on the arduino).
Check out: http://www.google.com/search?client=ubuntu&channel=fs&q=arduino&ie=utf-8&oe=utf-8
If you just want to connect something to the computer serial/parallel port and 'talk' to it, you can use most languages. In Visual Basic you'll need a dll to achieve this. Java may be able to do it too.
If you want to program a microcontroler chip, you'd best learn C, because this is the language used to program most of them, although some of them accept basic, java, processing and C++.
There are a number of basic stamps you can use to get your feet wet. parallax for example made their business on basic based embedded systems. If you want to move forward at that programming level you really need to learn C for the most coverage, and I highly recommend assembler as well, at least a few different instruction sets.
You might be interested in Gadgeteer. I got to play with a kit a few weeks ago, and it's amazing fun. You can't currently do VB, but you can do C# and VB is coming very soon.

Need simulator of 8051 with a 'c' compiler?

Is there any simulator of 8051 which comes with 'c' compiler so that i can compile our c code and able to view the result ?
sdcc is a commonly used C compiler for the 8051 and googling 8051 simulator results in several simulator tools.
For a good c compiler use Keil C51. It is an excellent compiler which a huge device database to select from!
You can use keil to generate a Hex file (in the Intel hex file format). You can then load the hex file into Edsim to simulate your design and see the output!
one of the best complier+simulator is keil C51.Just download it use trial version that is sufficient for beginner programming .It support both assembly language as well as embedded C.
So it is best for you .Again it having debugger which is used for checking your code in machine level.
Another simulator is there for you ISIS professional which is best among all the simulator I used till date.It provide circuit simulator which having a lot of peripheral library for easy design of circuit.And you can load your code to this for see the real time behavior of your circuit with your code .Just google it to find out more about ISIS professional.Again free version is sufficient for starting Embedded C.It also support virtual devices like volt meter,oscilloscope,signal generator....
So I think this is best for starting embedded study.But use keil debugger for better knowing behavior of your code in machine level.

Arm Board Bring Up

Can anybody tell me where I can find information related to How to Bringup any arm board? I am looking for an overview as I am novice in ARM related stuffs. Any link/document will do ...It will be gr8 help if i can look for a case-study
any arm based board can be considered..I am looking for just a case study...simple in few steps??
Every single ARM "board" will be different. Read the datasheet for the ARM chip you have, that should have a section near the start about booting. Also, read the datasheet about your board, as it made have flash/boot loaders on there. If there are no loaders on the board, you'll have to either set the jumpers for the ARM (if that type supoprts it) to read from external rom, or JTAG the initial boot code into it.
Basically: Read the datasheets. Programming a device like an ARM isn't your usual compile/run stratergy like most software, especially not in the first stage.
edit:
If you don't even have a board yet, try going for this one:
http://beagleboard.org/
It has and ARM on it (as well as a decent GPU).
Check the DLP-2232PB-G evaluation kit from FTDI. Looks great for newbies trying to get into microcontrollers, and it comes with everything you need. It's a PIC controller - not an ARM controller, but the easiest starting point that I've seen... and same basic methods of development.
I would start with any documentation the IC manufacturer may have on "getting started".
http://free-electrons.com/doc/porting-kernel.odp
This link gives a good overview of the bringup of the board with a CPU for which the linux support package is available.
Linux sources in arch/arm have mach-* which are cpus supported by Linux Kernel.
With in the mach-* dir, there are some board specific files that are board specific BSPs.
You can take the process elucidated in this article and try using in your case.
Check out the ok6410-h at http://www.arm9board.net/sel/prddetail.aspx?id=348&pid=200
Quit a nice kicking-start kit coming with everyting you would ever need: documentations, source code, example programs.
recommendable for both newbies and experienced.