diff options
| author | FreeArtMan <dos21h@gmail.com> | 2022-08-25 13:16:37 +0100 | 
|---|---|---|
| committer | FreeArtMan <dos21h@gmail.com> | 2022-08-25 13:16:37 +0100 | 
| commit | 9da24b9857e2654c4101024086f8c84e7c74e7e1 (patch) | |
| tree | 2dbcdca725c729fe1a49cdd014c5293fb8dc2ceb /md/notes | |
| parent | ccb48ea963fe9861b4e6de0eaec74c7fdd0cc94b (diff) | |
| download | md-content-9da24b9857e2654c4101024086f8c84e7c74e7e1.tar.gz md-content-9da24b9857e2654c4101024086f8c84e7c74e7e1.zip  | |
Added avr8
Diffstat (limited to 'md/notes')
| -rw-r--r-- | md/notes/undefined_c/titles.md | 62 | 
1 files changed, 46 insertions, 16 deletions
diff --git a/md/notes/undefined_c/titles.md b/md/notes/undefined_c/titles.md index 85a8456..a383b82 100644 --- a/md/notes/undefined_c/titles.md +++ b/md/notes/undefined_c/titles.md @@ -1631,18 +1631,12 @@ rustc main.rs -l lib -L . -o hello -C link-arg="-Wl,-rpath=./"  ## Multiplatform -### Cross compile - - - - -  ### Different flags -  ### Check architecture +  ### AArch64  https://snapshots.linaro.org/gnu-toolchain/13.0-2022.08-1/aarch64-linux-gnu/ @@ -1694,22 +1688,58 @@ Hello world arm64  ### AVR8 +AVR is 8bit CPU that is quite popular for hobbiest. As baremetal device its doesnt have full libc support, +and needs some setup before its possible to do basics things with it. -### Emscripten +__avr_echo.c__ +```c +#include <avr/io.h> -[/writeup/web_assembly_sdl_example.md](/writeup/web_assembly_sdl_example.md) +#define FOSC 16000000UL +#define BAUD 9600 +#define MYUBRR FOSC/16/BAUD-1 -#### Embed in JS +void USART_Init( unsigned int ubrr) +{ +	UBRRH = (unsigned char)(ubrr>>8); +	UBRRL = (unsigned char)ubrr; +	UCSRB = (1<<RXEN)|(1<<TXEN); +	UCSRC = (1<<URSEL)|(1<<USBS)|(3<<UCSZ0); +} +int main() +{ +	char c; +	USART_Init( MYUBRR ); +	while(1) +	{ +		while ( !(UCSRA & (1<<RXC))){}; +		c = UDR; +		while (!(UCSRA & (1<<UDRE))){}; +		UDR = c; +	} +	return 0; +} +``` + +``` +avr-gcc avr_echo.c -mmcu=atmega16 -Wall -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -o avr_echo.out +``` + +Next steps woule be to programm it, in case you have ISPv2 programmer and ATmega16 chip +```bash +avr-objdump -s --disassemble avr_echo.out > avr_echo.s +avr-objcopy -j .text -O ihex avr_echo.out avr_echo.hex +avrdude -pm16 -cavrispv2 -Pusb -U flash:w:avr_echo.hex +``` + +### Emscripten -## Graphics +[/writeup/web_assembly_sdl_example.md](/writeup/web_assembly_sdl_example.md) + +#### Embed in JS -### SDL2 -### GTK -### OpenGL -### Shaders -### Generate image  | 
