Compilation scripts and major refactoring
This commit is contained in:
parent
8ca42b59b2
commit
6867982f6f
6
.gitignore
vendored
Normal file
6
.gitignore
vendored
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
*.d
|
||||||
|
*.o
|
||||||
|
*.eep
|
||||||
|
*.elf
|
||||||
|
*.hex
|
||||||
|
*.pdf
|
1
asm_alg.xml
Normal file
1
asm_alg.xml
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<mxfile host="app.diagrams.net" modified="2021-01-24T12:48:20.350Z" agent="5.0 (Windows)" etag="FSfYhUCdbVDNfYVQ8Vhe" version="14.1.9" type="device"><diagram id="pHpJbLtIqph5go0xJfpR" name="Page-1">3Vrdj6M2EP9b+pDHq2xD+HjM17ZS96S228+nExfcQEviyHE2yf71NdiGAUyWu0vCbqTIGg8z2B7Pb8ZjMnJm6+MPPNomH1lMsxFB8XHkzEeEYJeQUf5D8UlxfM9RjBVPYy1UMZ7SF6qZSHP3aUx3NUHBWCbSbZ25ZJsNXYoaL+KcHepi/7CsPuo2WtEW42kZZW3un2ksEsUNiF/xf6TpKjEjYy9UT9aREdYr2SVRzA6A5SxGzowzJhS1Ps5olhvP2EXpPXQ8LSfG6Ub0UfB/mf36+HsQjF9esunhp/9++wN9/ID1bjxH2V6vWM9WnIwJaCwtoruMi4St2CbKFhV3ytl+E9N8HCR7lcwjY1vJxJL5LxXipLc32gsmWYlYZ/qpGjMfqHNxmrVje76k51aknSTiKyrOyLnlFkjfpWxNBT9JPU6zSKTP9XlE2olWpVxlZ0loU3+J2dtWl6YL53k7RSNpk8A3tGynRbsY5TvsZXJV08+SWOVEtnbGnziNYvNEzqd82NrKaqNyqx+SVNCnbVTY8yDxa9uUZ8oFPZ7flrYZjcJYaRwq6GCDhwTAxkPXMjS5N/92e/q3N6R/u3b/hj79UHi5oscFHQLvXxQtKVpctA+599sVlYoCCQFDKDgFRr0TC+imWNCJMEBDQ8MShN43NLye0PCHhIZnh0bQ8ljP0I00oDg+kFT+7wBEWIEDQVHPK3nrAFqBaPGhPg9JuwB7NdGiDTsgWgpgwEdgGfBVyCyg1J0WnNlbAzD2BkcwujcE+z0RHAyJYP/15OZWrhzibkRiAC1imOcPgehCGHvr6ZG4g6PLcoh53+gKeqIrHBJdgcXqqrKJ0+eysJHWnMAEOdEQITA3QQG32/GhygTQ8xYErYoXB2JZx8EFW2zQLAXfXkhB3xU7iJC9ONXz501Oc+kN0O2SaJuTmYTQY7pOxXXjkw5IDrEEpLElIGF0tYhkOTsOEJGkwfjpr1z/+7Hp/q1fV3Tmx1rvpHsXjGRhz0imkso3hLJCdcJ5dAICW5ZuxA68+eecAVKZj2q5zA0bN3OvyOPz4mXKs4pLQs238rNy4V/vemHfqBw2ImhZknhFlGnUNRNbGLrD4P3tESxOOV2KlG3yp3QnLhPUXNsp68ZBzZbw3/Uxy5xkX49Og15EmGk265gLQqJ4QwXRsq6fA079wFINaqr+mjyq7imaRxsI5gKKVRAZd+OfmKgEh56ZtyFww4jA1YS6bQE3L0MXTwTVU4IzdPFE7u5qAve9m8CDlk+4x+3EA0ACNpdrqAV7H1wrlmgsoYJqdBNO8D1OaziiZUqtCt6+4TRQF4L5Q5Rag4LfUfVYA0HDK18Ba90lrwBdbKszbotdcnfY7VsvdO3VjbBrOWVL600aObfx9SuwuTbMvF/xwQwVl/lvDBllfzhk2D6ZfXEZ1KtEuPWX+paxr/h9Unarv72oCrX685Cz+B8=</diagram></mxfile>
|
BIN
img/lm35.jpg
Normal file
BIN
img/lm35.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 47 KiB |
BIN
img/serial_log.png
Normal file
BIN
img/serial_log.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
BIN
img/t_cold.jpg
Normal file
BIN
img/t_cold.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.3 MiB |
BIN
img/t_warm.jpg
Normal file
BIN
img/t_warm.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.2 MiB |
BIN
img/voltage_cold.jpg
Normal file
BIN
img/voltage_cold.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.7 MiB |
BIN
img/voltage_warm.jpg
Normal file
BIN
img/voltage_warm.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.6 MiB |
BIN
presentation.odp
Normal file
BIN
presentation.odp
Normal file
Binary file not shown.
BIN
report.odt
BIN
report.odt
Binary file not shown.
|
@ -1,9 +1,9 @@
|
||||||
; Copyright 2021 KoroLion (https://github.com/KoroLion)
|
; Copyright 2021 KoroLion (https://github.com/KoroLion)
|
||||||
|
|
||||||
#define __SFR_OFFSET 0
|
#define __SFR_OFFSET 0
|
||||||
#define LED_PORT 7
|
#define LED_PORT 7 // led port
|
||||||
|
|
||||||
#include "avr/io.h" // ~ #include "avr/iom328p.h"
|
#include "avr/io.h" // #include "avr/iom328p.h"
|
||||||
|
|
||||||
.section .bss
|
.section .bss
|
||||||
lm35_port: .byte 0
|
lm35_port: .byte 0
|
||||||
|
@ -127,7 +127,7 @@ lm35_read:
|
||||||
mov r24, r30 ; uint8_t return value
|
mov r24, r30 ; uint8_t return value
|
||||||
adiw r24, 2 ; due to LM35 formula (2C to 150C)
|
adiw r24, 2 ; due to LM35 formula (2C to 150C)
|
||||||
|
|
||||||
|
clr r1 ; docs requirement
|
||||||
sei ; allow interruptions
|
sei ; allow interruptions
|
||||||
clr r1 ; c requirement
|
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
|
13
src/avr_asm_lib/avr_asm_lib.h
Normal file
13
src/avr_asm_lib/avr_asm_lib.h
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
#ifndef __AVR_ASM_LIB.H
|
||||||
|
#define __AVR_ASM_LIB.H
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
void lm35_init(unsigned char port);
|
||||||
|
unsigned char lm35_read();
|
||||||
|
|
||||||
|
void led_init();
|
||||||
|
void led_enable();
|
||||||
|
void led_disable();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __AVR_ASM_LIB.H
|
|
@ -1,22 +1,17 @@
|
||||||
// Copyright 2021 KoroLion (https://github.com/KoroLion)
|
// Copyright 2021 KoroLion (https://github.com/KoroLion)
|
||||||
|
|
||||||
extern "C" {
|
#include "avr_asm_lib.h"
|
||||||
void lm35_init(unsigned char port);
|
|
||||||
unsigned char lm35_read();
|
|
||||||
|
|
||||||
void led_init();
|
|
||||||
void led_enable();
|
|
||||||
void led_disable();
|
|
||||||
}
|
|
||||||
|
|
||||||
const unsigned char LED_TEMP = 30;
|
const unsigned char LED_TEMP = 30;
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
lm35_init(17);
|
lm35_init(17);
|
||||||
led_init();
|
led_init();
|
||||||
|
Serial.begin(9600);
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
unsigned char t = lm35_read();
|
unsigned char t = lm35_read();
|
||||||
|
Serial.println((short)t);
|
||||||
if (t >= LED_TEMP) {
|
if (t >= LED_TEMP) {
|
||||||
led_enable();
|
led_enable();
|
||||||
} else {
|
} else {
|
||||||
|
|
16085
src/avr_asm_lib/avrdude.conf
Normal file
16085
src/avr_asm_lib/avrdude.conf
Normal file
File diff suppressed because it is too large
Load Diff
14
src/avr_asm_lib/build.bat
Normal file
14
src/avr_asm_lib/build.bat
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
rm build/avr_asm_lib.ino.cpp
|
||||||
|
rm build/avr_asm_lib.h
|
||||||
|
cp avr_asm_lib.ino build/avr_asm_lib.ino.cpp
|
||||||
|
cp avr_asm_lib.h build/avr_asm_lib.h
|
||||||
|
|
||||||
|
"C:\\Users\\KoroLion\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7\\bin\\avr-gcc" -c -g -x assembler-with-cpp -flto -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR avr_asm_lib.S -o build/avr_asm_lib.S.o
|
||||||
|
|
||||||
|
"C:\\Users\\KoroLion\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR build/avr_asm_lib.ino.cpp -o build/avr_asm_lib.ino.cpp.o
|
||||||
|
|
||||||
|
"C:\\Users\\KoroLion\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-gcc" -w -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections -mmcu=atmega328p -o build/avr_asm_lib.ino.elf build/avr_asm_lib.S.o build/avr_asm_lib.ino.cpp.o -lm
|
||||||
|
|
||||||
|
"C:\\Users\\KoroLion\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-objcopy" -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 build/avr_asm_lib.ino.elf build/avr_asm_lib.ino.eep
|
||||||
|
|
||||||
|
"C:\\Users\\KoroLion\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-objcopy" -O ihex -R .eeprom build/avr_asm_lib.ino.elf build/avr_asm_lib.ino.hex
|
2
src/avr_asm_lib/build/.gitignore
vendored
Normal file
2
src/avr_asm_lib/build/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
avr_asm_lib.ino.cpp
|
||||||
|
avr_asm_lib.h
|
1
src/avr_asm_lib/upload.bat
Normal file
1
src/avr_asm_lib/upload.bat
Normal file
|
@ -0,0 +1 @@
|
||||||
|
"C:\Users\KoroLion\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17\bin\avrdude" -Cavrdude.conf -v -patmega328p -carduino -PCOM6 -b57600 -D -Uflash:w:build/avr_asm_lib.ino.hex:i
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user