Building Atmel START project to load with UF2 bootloader - embedded

I'm trying to build an Atmel START project using GCC such that it will load with the Adafruit UF2 bootloader on a SAMD21 chip.
From prior research I've learned that I need to have the text section start at offset 0x2000, and I need to specify the same offset to bossac when flashing.
I've done both, and confirmed that they are working as intended by reading back the memory but I'm still not able to flash a minimal blinky built using Atmel code.
What am I missing?

I solved my own issue, turns out it was a bug in my code, since I never put a delay after the GPIO write, the LED wasn't turning on. Adding a delay solved the issue.

Related

Program uploading to LPC 2148 by the time of component assembling

I am developing an elevator GLCD display (128*64) with LPC2148 Micro controller, I have done program and PCB designing also. Now I want to upload the program to micro controller, how to do it? Before fixing micro controller or after fixing micro controller want to upload program?
If I understand correctly you want to program the device without using a bootloader or a JTAG. There is some standalone programmers available for the LPC2148 device. Example here. This will allow the MCU to be programmed before placing it on the board.
The maintainability of your design however raises red flags. You should at least have a JTAG header on the board even if it is not populated. JTAG is very flexible and cheap and add lots of development and testing options.
If I am right, than the LPC2100 series does have an ROM bootloader. You only have to pull a pin (I think P0.14) to ground while reset.
Flashmagic would than be a tool of choice to download the program.
Pro: No additional hardware needed.
Con: The bootloader pin and USART (normally USART0) need to be accessable.
1.Use the Keil compiler to compile your code and
generate hex file
2.Download and Install Flash Utility
3.In flash utility
Select Com port ,Board, Baud rate (may be default) and file
4.Now click on Upload to flash

Infineon TLE9879 Cortex M3 reset behavior

I'm developing for a custom embedded board having an Infineon TLE9879 which is a motor controller containing an ARM Cortex-M3 programmable core. My code runs fine from flash with the debugger attached, but when I disconnect it to run the product stand-alone I get nothing. We have an evaluation board up and running with the same code, so my first thought was something different in the hardware. The eval board has an extra chip for the JTAG interface, so it's not really possible to run it the same way. The eval board does run stand-alone if I unplug the USB cable but there is still extra hardware connected on the board that is not present in our product. The connections on our JTAG appear to match the recommendations, and I am able to make it work with connected to the IDE.
Is there anything internal to the chip that may need to be configured when programming that might be set incorrectly? Any other ideas? This feels like a missing pull-up or misconfigured bit preventing it from getting out of reset.
update: It actually work stand-alone sometimes, but usually does not. It does seem to be running, as we have a PWM output to indicate status and that is running even if nothing else works. I will try to hack the code to get a more meaningful status out the PWM. I'm still confused as to why it would always run fine with the debugger attached and hardly ever without it.

How can I learn to build my own bootloader for an embedded system?

Does anyone know of a good learning resource for building your own bootloader for an embedded system? From reading various textbooks, I have a good overview of what a bootloader is supposed to do, and some textbooks include snippets of assembler to show how the bootloader should be built.
However, when I search for resources/tutorials that describe how to build a bootloader, everything I've found so far is either too advanced, (assuming a knowledge of certain preliminaries and are thus hard to follow), or, they are dealing with creating a bootloader for a pc or an emulator. Ideally I'm looking for a single resource/book, that covers preliminaries, and walks me through the process. I'm happy to purchase a particular chip, and relevant cables, if the tutorial/textbook requires that.
The term bootloader is quite broad, so does your quest have roots in a few dozen lines of code with a serial bootloader or are you interested in a linux type full blown operating system (uboot) that has gobs of features and drivers and stacks?
If you dont already know that answer or dont know what I am talking about you need to figure that out, I would start small...even if you desire the huge monster operating system solution, you should start with bare metal (which is what a bootloader is, a bare metal program) chip comes out of reset, your code runs first, blinks an led. Then control the rate of the blinking led, then if you have a push button read the push button and make it change the led (demonstrating input and output). Then find and use a timer to blink the led if you didnt already (use polling first please, interrupts later). Now you can do clock math and have an idea how the chips clock tree is so use that to get a uart up, tx only first, then rx/tx echo what your receive. THEN you are ready to talk about your first bootloader, which should involve some serial protocol (invent your own or use xmodem or something) that actually "boots" and then lets you "load" other programs after booting.
You can do all of this (well virtual leds in some other form) using simulators, and that may not be a bad idea since the hard part of bare metal is first off controlling the assembler compiler and linker to make a binary that actually boots up and runs. Then piles of sub $10 and sub $20 boards that you can learn to write a bootloader for (msp430 launchpads, the other launchpads, stm32f0 and f4 discovery boards, the raspberry pi, probably not the beagles avoid those for now, oh and a myriad of avr based boards, avoid x86 start with microcontrollers, arm, avr, msp430).

Can't erase the first 256KB of Nor Flash(M29W256GL) using BDI2000

I'm porting u-boot-2013.10 to MPC8306 based board. Previously, I can erase the first several sectors of Nor Flash using BDI2000. But after sometime, when the porting task is nearly done, (I mean that I can use gdb to trace the code execution and find the u-boot code runs into command line mainloop, though there are no serial output at the time, due to error configure of Serial Port)the first 256KB of Nor Flash can't be erased even if after power off reset. Other sectors can be erased normally.
The Nor Flash is Micron M29W256GL, with block size 128KB. I'm sure the WP# Pin has been pulled high, so there is no hardware protection upon the first block.
When config the jumper on board to change the PowerPC Config Word in order not to let MPC8306 fetch boot code at power up, the problem remains.
I used to run u-boot-1.1.6 on this board, I have erased this version of u-boot so many times without the problem mentioned above. I guess u-boot-2013.10 made some new approach to flash manipulation or others, for example, non-volatile protection on first 256KB of flash.
Is there someone can help me to solve the problem? I would very much appreciate your help.

Running an Arduino sketch with Fritzing

I am trying to learn programming on hardware, and have ordered an Arduino for that. While I wait for it to be delivered, I started to poke around and came across Fritzing. I am able to attach an LED to the microcontroller. My problem is this:
Fritzing comes with an IDE that can be used to write code for the Arduino and PICAXE microcontrollers. Having written the code to blink the LED on an Arduino, I am unable to compile it and attach it to the schematic I have made. How do I do that? The page Experimental program window is not really helpful.
I work on the Fritzing team. Picaxe programming does work in Fritzing, but currently Arduino programming does not--the long story is that there is no easy shell command for launching the Arduino compiler and uploader.
You can edit programs for the Arduino in Fritzing, but to run them you still have to use the Arduino IDE. We should make it clearer that Arduino programming is not full available in Fritzing.
It is currently not possible to simulate an Arduino circuit with Fritzing. Neither are there any plans to simulate Arduino.
Check this link:
http://fritzing.org/forum/thread/3/