Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NHC-Link042: Convert Keil to Cmake Makefile with tool from https://github.com/phodina/ProjectConverter #251

Closed
wants to merge 3 commits into from

Conversation

zoobab
Copy link
Contributor

@zoobab zoobab commented Oct 30, 2023

NHC-Link042: Convert Keil to Cmake Makefile with tool from https://github.com/phodina/ProjectConverter

@zoobab
Copy link
Contributor Author

zoobab commented Oct 30, 2023

I should add a small doc on how to build the firmware:

zoobab@chonche /home/zoobab/soft/ch32v003fun/attic/NHC-Link042 [13]$ cmake .
-- Configuring done
-- Generating done
-- Build files have been written to: /home/zoobab/soft/ch32v003fun/attic/NHC-Link042
zoobab@chonche /home/zoobab/soft/ch32v003fun/attic/NHC-Link042 [14]$ make
[ 4%] Building C object CMakeFiles/NHC-Link042.elf.dir/User/it.c.o
[ 8%] Building C object CMakeFiles/NHC-Link042.elf.dir/User/main.c.o
In file included from /home/zoobab/soft/ch32v003fun/attic/NHC-Link042/./STM32F0x2_USB-FS-Device_Lib_V1.0.0/Libraries/STM32_USB_Device_Driver/inc/usb_dcd.h:33,
from /home/zoobab/soft/ch32v003fun/attic/NHC-Link042/./STM32F0x2_USB-FS-Device_Lib_V1.0.0/Libraries/STM32_USB_Device_Library/Core/inc/usbd_core.h:33,
from /home/zoobab/soft/ch32v003fun/attic/NHC-Link042/./STM32F0x2_USB-FS-Device_Lib_V1.0.0/Libraries/STM32_USB_Device_Library/Core/inc/usbd_usr.h:33,
from /home/zoobab/soft/ch32v003fun/attic/NHC-Link042/User/main.c:2:
/home/zoobab/soft/ch32v003fun/attic/NHC-Link042/./STM32F0x2_USB-FS-Device_Lib_V1.0.0/Libraries/STM32_USB_Device_Driver/inc/usb_core.h:431:6: warning: redundant redeclaration of 'SetBTABLE' [-Wredundant-decls]
431 | void SetBTABLE(uint16_t /wRegValue/);
| ^~~~~~~~~
/home/zoobab/soft/ch32v003fun/attic/NHC-Link042/./STM32F0x2_USB-FS-Device_Lib_V1.0.0/Libraries/STM32_USB_Device_Driver/inc/usb_core.h:430:6: note: previous declaration of 'SetBTABLE' was here

[...]

[100%] Linking C executable bin/NHC-Link042.elf
/usr/lib/gcc/arm-none-eabi/10.3.1/../../../arm-none-eabi/bin/ld: warning: cannot find entry symbol Reset_Handler; defaulting to 0000000008000000
[100%] Built target NHC-Link042.elf
[100%] Built target NHC-Link042.bin
[100%] Built target NHC-Link042.hex
text data bss dec hex filename
396 1084 1568 3048 be8 /home/zoobab/soft/ch32v003fun/attic/NHC-Link042/bin/NHC-Link042.elf
[100%] Built target size

@cnlohr
Copy link
Owner

cnlohr commented Oct 30, 2023

Please just use makefiles for this. CMake has been such a pain to maintain across builds. Or is there some other reason to use CMake over Make?

@zoobab
Copy link
Contributor Author

zoobab commented Oct 30, 2023

I could only found that tool (I tried keil2gcc but I did not manage to compile it), and was happy to find this other python tool, but which only supports cmake as output. Let's see if I find another converter cmake->makefiles.

@zoobab
Copy link
Contributor Author

zoobab commented Nov 8, 2023

@cnlohr if you succeed in compiling this tool (I have added g++ -IPersistanceLibrary/Source/BasicTypes -IPersistanceLibrary/Source/Math), I am still failing to build a working binary, maybe it can generate a simpler Makefile.

@cnlohr
Copy link
Owner

cnlohr commented Nov 21, 2023

I urge you to just write what you need to to make it work. Don't be afraid of makefiles, just figure out what needs to be passed into the compiler to make it work.

@zoobab
Copy link
Contributor Author

zoobab commented Nov 24, 2023

I asked Openchat LLM to convert the cmake to a makefile, it gave me some output Makefile, now I just need to make it work...

@cnlohr
Copy link
Owner

cnlohr commented Nov 25, 2023

It is not hard to write a makefile. It's just

output_thing : things_that_constitute it
	command_used_to_make_output_from_input

Everything else is just sugar.

@zoobab
Copy link
Contributor Author

zoobab commented Dec 29, 2023

I am looking to port this firmware to an STM32F103, does anybody has a link to the similar V1.0.0 library for it?

@cnlohr cnlohr closed this Feb 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants