Skip to content

Instantly share code, notes, and snippets.

View MRobertEvers's full-sized avatar

Matthew Evers MRobertEvers

View GitHub Profile
@MRobertEvers
MRobertEvers / PocketBeagleBoot.md
Last active May 23, 2022 23:21
Boot PocketBeagle into Bare Metal Code

Introduction

BeagleBoard came out with a new iteration called PocketBeagle in late september 2017. The new Beagle is minimalistic in nature, consisting primarily of an SD Card Reader, a Micro USB Interface, and the Octavo Systems OSD3358 1GHz ARM® Cortex-A8 System-in-Package (SIP).
The getting started page for the BeagleBoard truly gets you going quick with Linux. However, those of us looking to learn embedded systems, are left high and dry. The resources on uses of the PocketBeagle/BeagleBoard for "bare metal" programming are much fewer in number than those for getting started with Linux.
When I bought the PocketBeagle, it was still very new. There were few resources online for "bare metal" booting/programming. This gist will hopefully document some of the problems I encountered while learning how to boot the PocketBeagle into my own code.

The Manual

The manual for the AM335x is 5000+

@MRobertEvers
MRobertEvers / Python_Circular_Imports.md
Last active May 6, 2018 19:22
Circular Imports In Python 3: When are they allowed?

Circular Imports in Python 3

I recently ran into a circular import problem in Python. In my search for an answer, I often came across people simply stating that "circular imports are OK." with little to no explanation. Don't be deceived! There are cases where circular imports do and don't work! This gist will hopefully illustrate those cases.

Edit: A good Discussion about cyclic imports. Also check this Stack Overflow Thread. The answer by pythoneer (at the time of writing, the second most voted answer), is one of the misleading statements that drove me to write this gist.

When It Works

Say we have two classes, Lefty and Righty, each in their own file.

# File Righty.py

import Lefty

@MRobertEvers
MRobertEvers / Python_Import_Other_Directories.md
Created May 6, 2018 19:41
Import Python Files From Another Directory Python 3

Import Python Files From Another Directory

I've come across various ways to include files from other directories in python. At this time, none of my python projects have ever scaled enough to warrant a nice directory structure but I find this information useful to know.

Module Search

The Python Docs 6.1.4 explain nicely what happens when you try to import a module.

When a module named spam is imported, the interpreter first searches for a built-in module with that name. If not found, it then searches for a file named spam.py in a list of directories given by the variable sys.path. sys.path is initialized from these locations:
- The directory containing the input script (or the current directory when no file is specified).
- PYTHONPATH (a list of directory names, with the same syntax as the shell variable PATH).
  • The installation-dependent default.
@MRobertEvers
MRobertEvers / stdMapCPPSurprise.md
Last active June 4, 2024 06:05
It's a good thing I'm not using tuples: c++ std::map and in-place construction

It's a good thing I'm not using tuples

Everybody who writes software will eventually become acquainted with the principle of least astonishment. Often when something doesn't behave the way we expect, we go to debug, or perhaps look for a helpful error message. In some cases, something is failing behind the scenes that results in an error message we don't expect.

Who said anything about tuples, std::map?

Suppose we want to organize a group of employees so they can easily be found by their employee id. We can use std::map<int, Employee> to contain our employees information. At this point, the only information we want on our employees is their name. So we write this class

#include <string>

class Employee

{

@MRobertEvers
MRobertEvers / WebDevNotes.md
Last active June 6, 2020 19:24
Web Development Gist

Web Devolopment Notes

Notes on the Buzzword soup of web development.

JavaScript

  1. JavaScript is single threaded in the web browser. *Web Workers provide a threading-like interface
  2. Operates on event loop. https://developer.mozilla.org/en-US/docs/Web/JavaScript/EventLoop
  3. What does the new operator do? https://stackoverflow.com/questions/6750880/how-does-the-new-operator-work-in-javascript

JavaScript Event Loop

https://www.youtube.com/watch?v=8aGhZQkoFbQ Javascript is basically a language interpreter with a stack and a heap. It is single threaded. Asynchronous programming is acheived by the libraries provided to it by the environment. E.g. setTimeout is offered by the web browser and accessible in Javascript. In that case, the Web Browser performs the input action after a given amount of time by placing the action into the Javascript event queue. When the main thread (read 'stack') is empty, the event loop places the callback onto Javascript's stack, and Javascript executes it.

@MRobertEvers
MRobertEvers / ESP32ISRsIRAM.md
Last active May 21, 2018 19:18
ESP-IDF Interrupt Service Routines In IRAM

ISRs in ESP32 FreeRTOS

As of 5/21/18 According the the ESP-IDF readthedocs here, ISRs must be placed in IRAM.

After some investigation, I found this to not be entirely true. I noticed that their UART driver did not have its ISR placed in IRAM and I set out to find out why they could get away with this.

Furthermore, the [SPI flash drivers] state that they disable all non-IRAM ISRs. I found that this is only true if the driver for some ISR is installed in a way that notifies the SPI drivers that the new driver is not IRAM.

See the following links for explanation ISRs in IRAM: IRAM ISRs and

@MRobertEvers
MRobertEvers / Bluetooth.md
Last active May 23, 2018 13:38
Bluetooth Notes

Pairing is the process of exchanging security information between two bluetooth devices so they can use an encrypted channel. Bonded means that the devices store a longer term key so that they need not reexchange security information. By that definition, a Bonded device is a paired device.

https://www.silabs.com/community/wireless/bluetooth/knowledge-base.entry.html/2017/05/16/understanding_thebl-sICq

http://blog.bluetooth.com/bluetooth-pairing-part-1-pairing-feature-exchange

https://stackoverflow.com/questions/36396456/bluetooth-difference-between-pairing-and-paging-bonding

@MRobertEvers
MRobertEvers / MobileDevNotes.md
Last active June 25, 2018 18:10
Mobile Dev Notes

Android Studio

What is Gradle

Gradle is a generic build system like Make (of course Gradle is more modern). It allows you to run scripts by using gradle.scripts or build.gradle. E.g.

dependencies{
    compile "Package..."
}