Skip to content

Instantly share code, notes, and snippets.

View MauroMombelli's full-sized avatar

Mauro Mombelli MauroMombelli

View GitHub Profile
@MauroMombelli
MauroMombelli / playing with stack and head
Last active March 19, 2019 22:43
stack moved correctly to top of the ram, but for some reason heap refuse to collaborate
/* Entry Point */
ENTRY(reset_handler)
/* Specify the memory areas */
/*
0x08000000 until 0x08010000 is reserved for BOOTLOADER! (64k)
*/
MEMORY
{
EEPROM (rwx) : ORIGIN = 0x08010000, LENGTH = 64K /*fake EEPROM!*/
@MauroMombelli
MauroMombelli / TCD1201Dbluepill.ino
Created July 4, 2018 15:45
NOT working script for TCD1201D on a bluepill using roger's core
#define SH PB3
#define PHI1 PB4
#define PHI2 PB5
#define BT PB6
#define RS PB7
#define OS A0 //A0
int sadc[2048 + 14]; // signal output values read
int sdacCounter = 0;
@MauroMombelli
MauroMombelli / parallelDownloadUpdate.sh
Last active January 7, 2019 22:55
Parallel download update for Arch Linux
#!/bin/bash
if [[ $UID -ne 0 ]]; then
sudo -p 'Restarting as root, password: ' bash $0 "$@"
exit $?
fi
#read mirrorlist, "Server =" lines, remove all before and including "= " (10 char)
readarray -t mirrorArray < <(grep "^Server =" /etc/pacman.d/mirrorlist | cut -c 10-)
function findTangentPoint(xR, yR, xW1, yW1, xW2, yW2 ){
if ( xW1 == xW2 ){
console.log("same x " +yR +" "+ yW1+" "+ yW2);
return new Point(xW1, constrain(yR, yW1, yW2) );
}
if ( yW1 == yW2 ){
console.log("same y " +xR +" "+ xW1+" "+ xW2);
return new Point(constrain(xR, xW1, xW2), yW1);
}
@MauroMombelli
MauroMombelli / Makefile
Last active September 18, 2016 13:56
This is a experimental makefile for CMSIS inclusion. STM32f303
CC=arm-none-eabi-gcc
CFLAGS= -Wall -Wextra -Wpedantic -Wformat -std=c11 -O0
LD=$(CC)
PROJECTNAME=Test_SPracingEVO
ODIR=build
LIBS= -I src -I lib/CMSIS -I lib/STM32F30x_StdPeriph_Driver/inc
@MauroMombelli
MauroMombelli / soft_mul.c
Last active June 4, 2016 11:58
Example of software multiplication between 2 double, NOT SAFE, NOT IEEE754 COMPLIANT, DON'T USE AND CRY
#include <stdint.h>
#include <stddef.h>
#include <stdio.h>
union double_to_uint64{
double value;
union{
uint64_t raw_double;
struct{
@MauroMombelli
MauroMombelli / Scheduler
Created January 10, 2015 20:04
java basic scheduler
package lwjglTests.chart;
import java.util.ArrayList;
import java.util.List;
import java.util.SortedMap;
import java.util.TreeMap;
public class Scheduler {
private long time = 0;
private SortedMap<Long, List<Container>> schedulationMap = new TreeMap<>();
@MauroMombelli
MauroMombelli / gist:cd9b5aac6d77a12fb421
Created November 27, 2014 19:49
How compile GMP for ARM
./configure --disable-shared --host=arm-none-eabi --build=x86_64-linux-gnu CFLAGS=--specs=rdimon.specs CC=arm-none-eabi-gcc AS=arm-none-eabi-as
@MauroMombelli
MauroMombelli / gist:57d6a3bfee258700fa6c
Created October 13, 2014 21:43
chibios 3.0 test usb error
[10743.328765] usb 2-1: new full-speed USB device number 2 using xhci_hcd
[10743.441982] usb 2-1: device descriptor read/64, error -71
[10743.545122] xhci_hcd 0000:03:00.0: Setup ERROR: setup context command for slot 1.
[10743.545135] usb 2-1: hub failed to enable device, error -22
[10743.651657] usb 2-1: new full-speed USB device number 3 using xhci_hcd
[10743.764868] usb 2-1: device descriptor read/64, error -71
[10743.868003] xhci_hcd 0000:03:00.0: Setup ERROR: setup context command for slot 1.
[10743.868016] usb 2-1: hub failed to enable device, error -22
[10743.974541] usb 2-1: new full-speed USB device number 4 using xhci_hcd
[10743.975721] usb 2-1: Device not responding to setup address.
@MauroMombelli
MauroMombelli / gist:36bbe0025fb5d7722234
Created October 13, 2014 21:27
chibios 2.6 test usb error
9797.467508] usb 2-1: USB disconnect, device number 31
[ 9810.374551] usb 2-1: new full-speed USB device number 32 using xhci_hcd
[ 9810.487773] usb 2-1: device descriptor read/64, error -71
[ 9810.590916] xhci_hcd 0000:03:00.0: Setup ERROR: setup context command for slot 1.
[ 9810.590930] usb 2-1: hub failed to enable device, error -22
[ 9810.697435] usb 2-1: new full-speed USB device number 33 using xhci_hcd
[ 9810.810657] usb 2-1: device descriptor read/64, error -71
[ 9810.913783] xhci_hcd 0000:03:00.0: Setup ERROR: setup context command for slot 1.
[ 9810.913796] usb 2-1: hub failed to enable device, error -22
[ 9811.020320] usb 2-1: new full-speed USB device number 34 using xhci_hcd