<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>cluttered heap - Articles</title>
    <description>Distributed Systems, Databases, Software Engineering, and more...
</description>
    <link>https://blog.luiscalado.eu</link>
    
      
        <item>
          <title>Onion Pi: Building a secure hotstop with Tor and Raspberry Pi</title>
          <description>&lt;p&gt;The goal of this article is to have an access point that allows clients to navigate anonymously, use cheap hardware and avoid privacy software on our devices.&lt;/p&gt;

&lt;p&gt;The list of tools required are:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Raspberry Pi&lt;/li&gt;
  &lt;li&gt;Wifi Dongle (if not using the Raspberry Pi with embedded WIFI)&lt;/li&gt;
  &lt;li&gt;Internet connection&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Note: A common understanding here is that we must be sure that our access point is secure because there is a chance that it could be listening to your connection even before the connection is delivered to the Tor network. You must be careful with the information stored in your browser and should use a privacy-safe browser and secure device.&lt;/p&gt;

&lt;p&gt;I will explain how we will make our access point. We will use a Raspberry Pi as our access point and a wifi dongle in access point mode. For that, we will use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;hostapd&lt;/code&gt;, keep in mind that you will need a wifi dongle with the necessary driver to set up &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;hostapd&lt;/code&gt;. Then two more things, the tor network itself and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dnsmasq&lt;/code&gt; to give the wifi clients an IP address.&lt;/p&gt;

&lt;p&gt;Before we start this endeavor, we need to set up the Raspberry Pi and enable SSH. Go to &lt;a href=&quot;https://www.raspberrypi.org/downloads/raspbian/&quot;&gt;raspbian downloads&lt;/a&gt; and download the operating system.
After you have downloaded and burned the operating system into your SD card. You can create an SSH file in the boot folder or use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;raspi-config&lt;/code&gt; to enable SSH.&lt;/p&gt;

&lt;p&gt;Now you can access it with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ssh pi@raspberry&lt;/code&gt; and the default password &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;raspberry&lt;/code&gt;. Change the default password, run &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;passwd&lt;/code&gt;, and insert the password for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pi&lt;/code&gt; user. Just for the sack of good practices update and upgrade the system.&lt;/p&gt;

&lt;p&gt;We need two interfaces to serve the wifi clients and the internet connection. The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;eth0&lt;/code&gt; interface will be used for our connection to the web and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wlan0&lt;/code&gt; to connect our wifi dongle.
Add the following configuration to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/network/interfaces&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
  address 192.168.2.4
  netmask 255.255.255.0
  network 192.168.2.0
  broadcast 192.168.2.255
  gateway 192.168.2.1
  dns-nameservers 192.168.2.1

allow-hotplug wlan0
iface wlan0 inet static
  address 172.24.1.1
  netmask 255.255.255.0
  network 172.24.1.0
  broadcast 172.24.1.255
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;After this disable the dhcpd with: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;systemctl disable dhcpcd&lt;/code&gt;. You can bring up the interface with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sudo ip link set wlan0 up&lt;/code&gt; and reboot the Raspberry for the network to be in place.&lt;/p&gt;

&lt;p&gt;Now we will set up the dnsmasq. Since each user needs an IP address when connected to the access point, the configuration will allow 100 clients connected to the access point.&lt;/p&gt;

&lt;p&gt;Install dnsmasq:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;apt-get &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;dnsmasq
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;We just have to change the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/dnsmasq.conf&lt;/code&gt; and restart the service.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;interface=wlan0
listen-address=172.24.1.1
bind-interfaces
server=8.8.8.8
domain-needed
bogus-priv
dhcp-range=172.24.1.50,172.24.1.150,12h
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The wifi dongle by default is not in AP mode, so you won’t be able to connect clients to the Raspberry. We must set up the wifi dongle as an access point. That’s where &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;hostapd&lt;/code&gt; come in place, with it our dongle will be listening for connections and have an SSID and password for the users. First run &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;apt-get install hostapd&lt;/code&gt; to install the tool. Next, we need to configure the hostapd, edit the configuration file &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/hostapd/hostapd.conf&lt;/code&gt; and insert the following configuration:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;interface&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;wlan0
&lt;span class=&quot;nv&quot;&gt;driver&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;nl80211
&lt;span class=&quot;nv&quot;&gt;ssid&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;AnonAP-Onion
&lt;span class=&quot;nv&quot;&gt;hw_mode&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;g
&lt;span class=&quot;nv&quot;&gt;channel&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;6
&lt;span class=&quot;nv&quot;&gt;macaddr_acl&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;0
&lt;span class=&quot;nv&quot;&gt;auth_algs&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;1
&lt;span class=&quot;nv&quot;&gt;ignore_broadcast_ssid&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;0
&lt;span class=&quot;nv&quot;&gt;wpa&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;2
&lt;span class=&quot;nv&quot;&gt;wpa_passphrase&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;1234678900
&lt;span class=&quot;nv&quot;&gt;wpa_key_mgmt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;WPA-PSK
&lt;span class=&quot;nv&quot;&gt;wpa_pairwise&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;TKIP
&lt;span class=&quot;nv&quot;&gt;rsn_pairwise&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;CCMP
&lt;span class=&quot;nv&quot;&gt;ctrl_interface&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/var/run/hostapd
&lt;span class=&quot;nv&quot;&gt;ctrl_interface_group&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;0
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;As we are using a custom configuration include &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;DAEMON_CONF=&quot;/etc/hostapd/hostapd.conf&quot;&lt;/code&gt; in the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/default/hostapd&lt;/code&gt; file. This will say to hostapd that we want to use our configuration file. After all this check if the file was correctly configured with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;hostapd -dd /etc/hostapd/hostapd.conf&lt;/code&gt;. And finally, restart the service with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;systemctl restart hostapd&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;At this point, we can connect to our access point and use it as an access point but you won’t have access to the internet. That happens because we need to forward the connection established by the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wlan0&lt;/code&gt; to the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;eth0&lt;/code&gt;.&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;iptables &lt;span class=&quot;nt&quot;&gt;-t&lt;/span&gt; nat &lt;span class=&quot;nt&quot;&gt;-A&lt;/span&gt; POSTROUTING &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; eth0 &lt;span class=&quot;nt&quot;&gt;-j&lt;/span&gt; MASQUERADE
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;iptables &lt;span class=&quot;nt&quot;&gt;-A&lt;/span&gt; FORWARD &lt;span class=&quot;nt&quot;&gt;-i&lt;/span&gt; eth0 &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; wlan0 &lt;span class=&quot;nt&quot;&gt;-m&lt;/span&gt; state &lt;span class=&quot;nt&quot;&gt;--state&lt;/span&gt; RELATED,ESTABLISHED &lt;span class=&quot;nt&quot;&gt;-j&lt;/span&gt; ACCEPT
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;iptables &lt;span class=&quot;nt&quot;&gt;-A&lt;/span&gt; FORWARD &lt;span class=&quot;nt&quot;&gt;-i&lt;/span&gt; wlan0 &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; eth0 &lt;span class=&quot;nt&quot;&gt;-j&lt;/span&gt; ACCEPT
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;iptables&lt;/code&gt; commands described above will forward those connections to the right interface and masquerade them as if it was the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;eth0&lt;/code&gt; connection. Save and load the iptables rules if you need to reboot the Raspberry. The following two steps will save the configuration and add them to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rc.local&lt;/code&gt;.&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;iptables-save &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; saved-iptables-rules
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cp &lt;/span&gt;saved-iptables-rules /etc/iptables-hostapd-rules

&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;vim /etc/rc.local
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;/sbin/iptables-restore &amp;lt; /etc/iptables-hostapd-rules
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Finally, we need to enable the IPv4 forwarding. Change the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;net.ipv4.ip_forward&lt;/code&gt; in the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/sysctl.conf&lt;/code&gt; to 1.
We can list the devices connected to the access point with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sudo iw dev wlan0 station dump&lt;/code&gt;.&lt;/p&gt;

&lt;h3 id=&quot;install-tor&quot;&gt;Install TOR&lt;/h3&gt;

&lt;p&gt;At this point, we can use the AP but we want to go further and let our clients navigate anonymously.
Install tor with:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;apt-get &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;tor
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now that tor is installed, let’s configure the port where tor will be listening and the necessary configurations needed by the tor proxy, go to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/tor/torrc&lt;/code&gt; and put the following config:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;SOCKSPort 9040
VirtualAddrNetworkIPv4 10.192.0.0/10
TransListenAddress 172.24.1.1
TransPort 9040
DNSListenAddress 172.24.1.1
DNSPort 53

AutomapHostsSuffixes .onion,.exit
AutomapHostsOnResolve 1
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The next step is to set the iptables to route TCP connections to the port we have set and also add rules to keep having DNS and SSH to our Raspberry:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;iptables &lt;span class=&quot;nt&quot;&gt;-t&lt;/span&gt; nat &lt;span class=&quot;nt&quot;&gt;-A&lt;/span&gt; PREROUTING &lt;span class=&quot;nt&quot;&gt;-i&lt;/span&gt; wlan0 &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; tcp &lt;span class=&quot;nt&quot;&gt;--dport&lt;/span&gt; 22 &lt;span class=&quot;nt&quot;&gt;-j&lt;/span&gt; REDIRECT &lt;span class=&quot;nt&quot;&gt;--to-ports&lt;/span&gt; 22
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;iptables &lt;span class=&quot;nt&quot;&gt;-t&lt;/span&gt; nat &lt;span class=&quot;nt&quot;&gt;-A&lt;/span&gt; PREROUTING &lt;span class=&quot;nt&quot;&gt;-i&lt;/span&gt; wlan0 &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; udp &lt;span class=&quot;nt&quot;&gt;--dport&lt;/span&gt; 53 &lt;span class=&quot;nt&quot;&gt;-j&lt;/span&gt; REDIRECT &lt;span class=&quot;nt&quot;&gt;--to-ports&lt;/span&gt; 53
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;iptables &lt;span class=&quot;nt&quot;&gt;-t&lt;/span&gt; nat &lt;span class=&quot;nt&quot;&gt;-A&lt;/span&gt; PREROUTING &lt;span class=&quot;nt&quot;&gt;-i&lt;/span&gt; wlan0 &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; tcp &lt;span class=&quot;nt&quot;&gt;--syn&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-j&lt;/span&gt; REDIRECT &lt;span class=&quot;nt&quot;&gt;--to-ports&lt;/span&gt; 9040
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Similar to what we did with the other configuration, save the new rules.&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;iptables-save &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; saved-iptables-rules
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cp &lt;/span&gt;saved-iptables-rules /etc/iptables-tor-rules

&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;vim /etc/rc.local
/sbin/iptables-restore &amp;lt; /etc/iptables-tor-rules
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Restart and enable tor:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;systemctl restart tor
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;systemctl &lt;span class=&quot;nb&quot;&gt;enable &lt;/span&gt;tor
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Connect a device and check if the setup was successful at &lt;a href=&quot;https://check.torproject.org&quot;&gt;check.torproject.org&lt;/a&gt;. Visit &lt;a href=&quot;https://3g2upl4pq6kufc4m.onion/&quot;&gt;DuckDuckGo&lt;/a&gt; and browse anonymously.&lt;/p&gt;
</description>
          <pubDate>2018-12-12T16:00:00+00:00</pubDate>
          <link>https://blog.luiscalado.eu/privacy/2018/12/12/onion-pi-hotspot.html</link>
          <guid isPermaLink="true">https://blog.luiscalado.eu/privacy/2018/12/12/onion-pi-hotspot.html</guid>
        </item>
      
    
      
        <item>
          <title>Programming Atmega328p with Avrdude</title>
          <description>&lt;p&gt;Arduino IDE it’s an awesome tool and helps a lot of beginners take the first steps with embedded systems. When you start to have bigger projects you may want to change to another tool, my tool of choice for embedded systems is Vim and with that comes using a makefile when I want to compile my projects.&lt;/p&gt;

&lt;p&gt;I’m doing this tutorial to explain to others how to compile your Arduino code without the IDE. This requires you to use a library called AVR Libc from Atmel, which is a C library for Atmel AVR 8-bit RISC microcontrollers.
The full documentation can be found &lt;a href=&quot;http://www.atmel.com/webdoc/avrlibcreferencemanual/&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Before starting the tutorial we need a set of tools that already come with the Arduino IDE. The two major tools are a compiler and software to upload our binary to the microcontroller.&lt;/p&gt;

&lt;p&gt;Installing the tools needed in Macos is fairly easy using homebrew. We need to run the following command:&lt;/p&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;brew &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;avrdude avr-gcc avr-objcopy
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Our code example is the LED blink and it’s like the hello world of embedded systems. Consists of an LED that blinks at a given frequency. The difference from the implementation that you may be used to is the fact that will be using the AVR Libc.&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/luisfmcalado/8ab79da7f1a15276220cb80fe634eafc.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;The implementation of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;blink.c&lt;/code&gt; will turn on and off the LED 13 from your Arduino Uno every two seconds.&lt;/p&gt;

&lt;p&gt;As I said before my tool of choice is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;make&lt;/code&gt;. This is a build tool that will execute the compilation and conversion to our binary that late will be uploaded to the microcontroller.&lt;/p&gt;

&lt;p&gt;The compilation of this example has three steps, shown here:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Compile the blink.c from C code to an object&lt;/li&gt;
  &lt;li&gt;Convert the object to an ELF file&lt;/li&gt;
  &lt;li&gt;Convert the ELF file to a binary HEX file&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Of course, as your project gets bigger the Makefile will get more complex. The use of dependencies and compatibility with different microcontrollers will make your code and build steps a new challenge. But meantime we just want to understand how to compile our simple “hello world!”.&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/luisfmcalado/fe00552f44975f99711c4b3d3169f65e.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;To run the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Makefile&lt;/code&gt;, you just need to be in the same directory as the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Makefile&lt;/code&gt; and run the following command:&lt;/p&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;make
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Yeah, now we have our binary file to be uploaded to the microcontroller. To accomplish that, Atmel has the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;avrdude&lt;/code&gt;.
Run the following command and parameters:&lt;/p&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;avrdude &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; m328p &lt;span class=&quot;nt&quot;&gt;-P&lt;/span&gt; /dev/tty.usbmodem1411 &lt;span class=&quot;nt&quot;&gt;-c&lt;/span&gt; arduino &lt;span class=&quot;nt&quot;&gt;-b&lt;/span&gt; 115200  &lt;span class=&quot;nt&quot;&gt;-D&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-U&lt;/span&gt; flash:w:blink.hex:i &lt;span class=&quot;nt&quot;&gt;-v&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now you should see your Arduino LED 13 switching on and off every 2 seconds.&lt;/p&gt;
</description>
          <pubDate>2017-10-09T20:10:00+00:00</pubDate>
          <link>https://blog.luiscalado.eu/embedded/2017/10/09/programming-atmega328p-with-avrdude.html</link>
          <guid isPermaLink="true">https://blog.luiscalado.eu/embedded/2017/10/09/programming-atmega328p-with-avrdude.html</guid>
        </item>
      
    
      
        <item>
          <title>Hi there from Turkana IV</title>
          <description>&lt;p&gt;Hello World,&lt;/p&gt;

&lt;p&gt;I will start this blog to pass on things I learn or find. I want to create a blog where I can express myself and give my honest opinion about random stuff. I aim to have tutorials, things I find by luck, and stuff discovered during my research. I hope some of those posts can be useful to other geeks.&lt;/p&gt;

&lt;p&gt;Meanwhile, I’m still setting up and preparing some content, so bear with me and subscribe to my &lt;a href=&quot;/feed.xml&quot;&gt;RSS&lt;/a&gt;.&lt;/p&gt;
</description>
          <pubDate>2017-10-04T20:10:00+00:00</pubDate>
          <link>https://blog.luiscalado.eu/welcome/2017/10/04/hi-from-turkana-IV.html</link>
          <guid isPermaLink="true">https://blog.luiscalado.eu/welcome/2017/10/04/hi-from-turkana-IV.html</guid>
        </item>
      
    
  </channel>
</rss>
