Skip to content

Instantly share code, notes, and snippets.

View cjbrigato's full-sized avatar

Colin J. Brigato cjbrigato

View GitHub Profile
defines.h:
// Force a functon to be copied&exec from RAM. Use sparingly
#define RAMFUNC __attribute((long_call, section(".ramfunc")))
ldscript:
The magic :
[...] memory from ldscript.. [...]
MEMORY
// nestable void in -> void out
void* *(*any_to_byte)(void * a){
byte_t a_asbyte = *((uint8_t*)a);
return a_asbyte;
}
//total transtype
typedef *(*any_to_byte)(void *) transtype;
@cjbrigato
cjbrigato / follow.c
Last active October 6, 2016 10:51
Best Joke since 1998
typedef void (*morpheusBullsh_t)();
morpheusBullsh_t follow(void* ra) {
uint8_t do = 0;
byte_t raBits = *((uint8_t*)ra);
for (uint8_t i = sizeof(*((uint8_t*)ra)) * 8; i > 0; i--) {
do = (raBits & 1);
raBits >>= 1;
}
if((*(char *)& 0x4321) != 0x21 ) {
diff --git a/common/usb_cdc.c b/common/usb_cdc.c
index 7fd2933..ffee677 100644
--- a/common/usb_cdc.c
+++ b/common/usb_cdc.c
@@ -56,7 +56,7 @@ const char devDescriptor[] = {
0x01,0x00, // Device release number (0001)
0x01, // iManufacturer // 0x01
0x00, // iProduct
- 0x00, // SerialNumber
+ 0xFD, // SerialNumber^M