mightymos / ReedTripRadio

Alternative firmware for wireless 433MHz door/window reed sensors triggered by magnetic contacts.
BSD 2-Clause "Simplified" License
155 stars 7 forks source link

Compilations Error Question #10

Closed chaisaeng closed 1 year ago

chaisaeng commented 1 year ago

I'm not very experience in embed programming. I have the same door sensor and want to try customize my own device. I started from creating a virtual box with debian 11 64bit machine then perform the following steps

apt-get install bison flex g++ libboost-dev texinfo cmake
wget https://jaist.dl.sourceforge.net/project/sdcc/sdcc/4.2.0/sdcc-src-4.2.0.tar.bz2
tar xjf sdcc-src-4.2.0.tar.bz2
cd sdcc-4.2.0
./configure --disable-pic14-port --disable-pic16-port
make && make install
sdcc -v
SDCC : mcs51/z80/z180/r2k/r2ka/r3ka/sm83/tlcs90/ez80_z80/z80n/ds390/TININative/ds400/hc08/s08/stm8/pdk13/pdk14/pdk15/mos6502 4.2.0 #13081 (Linux)
published under GNU General Public License (GPL)

cd 
git clone https://github.com/area-8051/stcgal-patched.git
git clone https://github.com/area-8051/uni-STC.git
cd uni-STC/demos/
git clone https://github.com/mightymos/ReedTripRadio.git
cd ReedTripRadio/
make
root@EmbededDevBox:~/uni-STC/demos/ReedTripRadio# make
sed: can't read s/^\(.*\.rel:.*\)/build\/\1/g: No such file or directory
make: *** No rule to make target 'build/dependencies.mk', needed by 'all'.  Stop.

I got error at the make command If I issue make command again I get many line of message from make below sdcc -mmcs51 --model-small -DMCU_FREQ=24000000UL -I. -I/root/uni-STC/hal -I/root/uni-STC/include -I/root/uni-STC/drivers --opt-code-size -o build/delay.rel -c /root/uni-STC/hal/delay.c In file included from /root/uni-STC/hal/delay.c:31: /root/uni-STC/hal/delay.h:59:4: warning: #warning "CAUTION! delay1us() is *NOT* available in this MCU family + frequency" /root/uni-STC/hal/delay.h:60:4: warning: #warning "configuration, using delay10us() to emulate it, but with less accuracy." /root/uni-STC/hal/delay.h:61:4: warning: #warning "To remove this warning, define the SUPPRESS_delay1us_WARNING macro." sdcc -mmcs51 --model-small -DMCU_FREQ=24000000UL -I. -I/root/uni-STC/hal -I/root/uni-STC/include -I/root/uni-STC/drivers --opt-code-size -o build/main.rel -c main.c In file included from main.c:7: /root/uni-STC/hal/delay.h:59:4: warning: #warning "CAUTION! delay1us() is *NOT* available in this MCU family + frequency" /root/uni-STC/hal/delay.h:60:4: warning: #warning "configuration, using delay10us() to emulate it, but with less accuracy." /root/uni-STC/hal/delay.h:61:4: warning: #warning "To remove this warning, define the SUPPRESS_delay1us_WARNING macro." main.c:416: warning 85: in function send_radio_packet unreferenced local variable : 'byteToSend' sdcc -mmcs51 --model-small --iram-size 113 --xram-size 0 --stack-size 16 --code-size 1017 -o build/ReedTripRadio.hex build/delay.rel build/main.rel in the same directory I got another directory named build with contains several files below

root@EmbededDevBox:~/uni-STC/demos/ReedTripRadio/build# ls
delay.asm  delay.rst        main.asm  main.rst           ReedTripRadio.lk
delay.lst  delay.sym        main.lst  main.sym           ReedTripRadio.map
delay.rel  dependencies.mk  main.rel  ReedTripRadio.hex  ReedTripRadio.mem

Could you tell me what I did wrong in my attempt to build this project. do I need to SUPPRESS_delay1us_WARNING

Hopefully this is not a burden to you and thanks in advance for your help.

mightymos commented 1 year ago

I see that @area-8051 recently made changes to the makefiles [https://github.com/area-8051/uni-STC/commit/c30b38aaa5e76e98cccf172b374772d0561e7962].

I am not sure what could be going wrong right now. Maybe I need to update my makefile somehow. But you do not need to suppress the delay1us warning, it is basically just saying that you cannot achieve a reasonably accurate one microsecond delay on this processor using the HAL. We do not require that fine a delay so it is okay.

However, you also seem to have generated an Intel HEX file.

Example Intel HEX format: https://developer.arm.com/documentation/ka003292/latest/

Does it appear to be valid hexadecimal or could you attach the file for me to examine?

chaisaeng commented 1 year ago

I'm not sure the hex file generated is correct or not but it seem to be comply with the specification you mention in that URL. I did not change any thing in the source file and start make as soon as I clone the repository. I can not attach .hex file here so I tar and gzip the whole build directory then attached in this thread. Thank very much for your contribution to all of us

build.tar.gz

area-8051 commented 1 year ago

You can #define SUPPRESS_delay1us_WARNING in project-defs.h to suppress the warning. As long as you don't use delay1us(), it has no impact.

As to the sed command, there must be a bug here. I've recently made a change so that it also works on Mac and other BSD, it could have had a side effect. I'd like you to do the following:

area-8051 commented 1 year ago

And also copy-paste the output of sed --version.

chaisaeng commented 1 year ago

I edit the file 2-mcu-rules.mk line 39 remove @ already. The following is output of sed --version

root@EmbededDevBox:~/uni-STC/demos/ReedTripRadio# sed --version
sed (GNU sed) 4.7
Packaged by Debian
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Jay Fenlason, Tom Lord, Ken Pizzini,
Paolo Bonzini, Jim Meyering, and Assaf Gordon.
GNU sed home page: <https://www.gnu.org/software/sed/>.
General help using GNU software: <https://www.gnu.org/gethelp/>.
E-mail bug reports to: <bug-sed@gnu.org>.

The following is the output of the command sequence make clean Note: I issue make clean then issue make later. the make clean remove directory build then first make got the same error as before second make create build directory with all the file previously created and .hex file

root@EmbededDevBox:~/uni-STC/demos/ReedTripRadio# make
sed -i '' "s/^\(.*\.rel:.*\)/build\/\1/g" build/dependencies.mk
sed: can't read s/^\(.*\.rel:.*\)/build\/\1/g: No such file or directory
make: *** No rule to make target 'build/dependencies.mk', needed by 'all'.  Stop.
root@EmbededDevBox:~/uni-STC/demos/ReedTripRadio# make
sdcc -mmcs51 --model-small  -DMCU_FREQ=24000000UL -I. -I/root/uni-STC/hal -I/root/uni-STC/include -I/root/uni-STC/drivers --opt-code-size -o build/delay.rel -c /root/uni-STC/hal/delay.c
In file included from /root/uni-STC/hal/delay.c:31:
/root/uni-STC/hal/delay.h:59:4: warning: #warning "CAUTION! delay1us() is *NOT* available in this MCU family + frequency"
/root/uni-STC/hal/delay.h:60:4: warning: #warning "configuration, using delay10us() to emulate it, but with less accuracy."
/root/uni-STC/hal/delay.h:61:4: warning: #warning "To remove this warning, define the SUPPRESS_delay1us_WARNING macro."
sdcc -mmcs51 --model-small  -DMCU_FREQ=24000000UL -I. -I/root/uni-STC/hal -I/root/uni-STC/include -I/root/uni-STC/drivers --opt-code-size -o build/main.rel -c main.c
In file included from main.c:7:
/root/uni-STC/hal/delay.h:59:4: warning: #warning "CAUTION! delay1us() is *NOT* available in this MCU family + frequency"
/root/uni-STC/hal/delay.h:60:4: warning: #warning "configuration, using delay10us() to emulate it, but with less accuracy."
/root/uni-STC/hal/delay.h:61:4: warning: #warning "To remove this warning, define the SUPPRESS_delay1us_WARNING macro."
main.c:416: warning 85: in function send_radio_packet unreferenced local variable : 'byteToSend'
sdcc -mmcs51 --model-small --iram-size 113 --xram-size 0 --stack-size 16 --code-size 1017 -o build/ReedTripRadio.hex build/delay.rel build/main.rel
root@EmbededDevBox:~/uni-STC/demos/ReedTripRadio# ls
build  LICENSE  main.c  Makefile  notes  photos  project-defs.h  README.md
root@EmbededDevBox:~/uni-STC/demos/ReedTripRadio# cd build
root@EmbededDevBox:~/uni-STC/demos/ReedTripRadio/build# ls
delay.asm  delay.rst        main.asm  main.rst           ReedTripRadio.lk
delay.lst  delay.sym        main.lst  main.sym           ReedTripRadio.map
delay.rel  dependencies.mk  main.rel  ReedTripRadio.hex  ReedTripRadio.mem
area-8051 commented 1 year ago

Thank you, I see what's wrong, I'll keep you posted when the fix will be available.

area-8051 commented 1 year ago

It should be fixed now, I only changed the sed version auto-detection code in 0-directories.mk.

chaisaeng commented 1 year ago

Thanks very much!!! it working now flawlessly. cheers