Skip to content

Instantly share code, notes, and snippets.

View GOOD-Stuff's full-sized avatar

Gustov Vladimir GOOD-Stuff

  • Russia, Vladimir
View GitHub Profile
@GOOD-Stuff
GOOD-Stuff / ad9371-phy.dts
Created February 19, 2021 12:10
Part of Device Tree Source with included AD9371 transceiver and AD9528 PLL. Generated for ZynqMP (zcu4cg)
spi@ff040000 {
compatible = "cdns,spi-r1p6";
status = "okay";
interrupt-parent = <0x4>;
interrupts = <0x0 0x13 0x4>;
reg = <0x0 0xff040000 0x0 0x1000>;
clock-names = "ref_clk", "pclk";
#address-cells = <0x1>;
#size-cells = <0x0>;
power-domains = <0x1f>;
@GOOD-Stuff
GOOD-Stuff / main.rs
Created December 25, 2020 08:22
Read binary file and write values like the text in another file. Support values formatting.
/**
@brief Read binary file, get hex values and write in another file like plain text.
Can be formatted by user (set Big/Little endian, value dimension).
*/
use std::env;
use std::fs;
use std::io;
use std::io::Write;
@GOOD-Stuff
GOOD-Stuff / example.S
Created December 17, 2019 11:20
Пример работы стека с массивом в GNU Assembler (GAS)
# compiled by
# gcc -m32 -gstabs+ -o exLaunch ex.S
# Для просмотра (в GDB) содержимого массива, можно воспользоваться командой:
# p/x (long[4])d
# Для просмотра (в GDB) содержимого стека, можно воспользоваться командой:
# x/4x $esp, где 4 - кол-во выводимых элементов в стеке
.data
d: .long 1, 2, 3, 4 # массив из 4х элементов
@GOOD-Stuff
GOOD-Stuff / main.go
Created December 18, 2018 17:08
Example of UDP echo server
package main
import (
"net"
)
func main() {
println("UDP TEST ARM v0.3")
defer func() {
@GOOD-Stuff
GOOD-Stuff / cache_cleaner.sh
Created September 18, 2018 11:35
If free memory is low, try to clear cache
#!/bin/bash
# Check size of free and used memory and clear cache if it needed
FREE_SIZE=`free | grep Mem | awk '{print $4}'`
USED_SIZE=`free | grep Mem | awk '{print $3}'`
#CLEAR_CACHE=`sync; echo 1 > /proc/sys/vm/drop_caches`
free_value=${FREE_SIZE}
used_value=${USED_SIZE}
@GOOD-Stuff
GOOD-Stuff / changePort.sh
Created June 20, 2018 09:01
Script for Marduk, change port of raw protocol and relaunch app
#!/bin/bash
# Change port of application
###########################################################
FILE_PORT=/opt/base_sw/.udp_port.txt
PATH_TO_PORT=/opt/base_sw
MARDUK_START=/opt/base_sw/sbin/app_launch.sh
echo
echo "Attention! After execution this script, application of Marduk will be relaunch"
@GOOD-Stuff
GOOD-Stuff / Makefile
Last active June 6, 2018 14:41
Example of Makefile for ARM Linux kernel
obj-m := main.o
main-y := ../src/main.o
KDIR := <path_to_kernel_src>
TOOL := <path_to_toolchain>/arm-xilinx-linux-gnueabi-
all:
make -C $(KDIR) CC=$(TOOL)gcc LD=$(TOOL)ld M=$(PWD) modules
clean:
make -C $(KDIR) M=$(PWD) clean
@GOOD-Stuff
GOOD-Stuff / clock_divider.v
Created December 19, 2017 14:06
Example of clock divider
// src: https://electronix.ru/forum/lofiversion/index.php/t111967.html
module divider (
input clk50,
output reg clk2
);
reg [4:0] counter;
reg a,b;
always @(posedge clk50)
@GOOD-Stuff
GOOD-Stuff / OpenMP_mapped.cpp
Last active May 21, 2020 02:34
Example of work with std::map and OpenMP
#include <iostream>
#include <vector>
#include <map>
#include <omp.h>
#include <ctime>
using namespace std;
int main(int argc, char *argv[]) {
unsigned int thread_count;
cout << "Threads: ";
@GOOD-Stuff
GOOD-Stuff / main.c
Created August 3, 2017 10:41
Some test suit for TMS320C6678
/*
* Project for TMS320C6678
* */
#include <stdio.h>
#include <stdint.h>
#define DEVSTAT 0x02620020
#define JTAGID 0x02620018
#define MM_REVID 0x01812000
#define PWRSTATECTL 0x02620150