Of course, I have, I use halcompile command.
First, I must edit source and give full path for include files colorcnc.h and etherbone.h, but this is not important.
Code:
root@E555:/temp/src/colorcnc# halcompile --compile --userspace colorcnc.c
gcc -I/usr/include -I/usr/include/linuxcnc -URTAPI -U__MODULE__ -DULAPI -Os -o colorcnc /tmp/tmpCaSFMZ/colorcnc.c -Wl,-rpath,/lib -L/lib -llinuxcnchal
In file included from /tmp/tmpCaSFMZ/colorcnc.c:7:
/usr/include/linuxcnc/rtapi_app.h:27:1: warning: data definition has no type or storage class
27 | EXPORT_SYMBOL(rtapi_app_main);
| ^~~~~~~~~~~~~
/usr/include/linuxcnc/rtapi_app.h:27:1: warning: type defaults to ‘int’ in declaration of ‘EXPORT_SYMBOL’ [-Wimplicit-int]
/usr/include/linuxcnc/rtapi_app.h:27:1: warning: parameter names (without types) in function declaration
/usr/include/linuxcnc/rtapi_app.h:28:1: warning: data definition has no type or storage class
28 | EXPORT_SYMBOL(rtapi_app_exit);
| ^~~~~~~~~~~~~
/usr/include/linuxcnc/rtapi_app.h:28:1: warning: type defaults to ‘int’ in declaration of ‘EXPORT_SYMBOL’ [-Wimplicit-int]
/usr/include/linuxcnc/rtapi_app.h:28:1: warning: parameter names (without types) in function declaration
/tmp/tmpCaSFMZ/colorcnc.c:20:15: error: expected declaration specifiers or ‘...’ before string constant
20 | MODULE_AUTHOR("romanetz");
| ^~~~~~~~~~
/tmp/tmpCaSFMZ/colorcnc.c:21:20: error: expected declaration specifiers or ‘...’ before string constant
21 | MODULE_DESCRIPTION("colorcnc board driver");
| ^~~~~~~~~~~~~~~~~~~~~~~
/tmp/tmpCaSFMZ/colorcnc.c:22:16: error: expected declaration specifiers or ‘...’ before string constant
22 | MODULE_LICENSE("GPL");
| ^~~~~
/tmp/tmpCaSFMZ/colorcnc.c:29:32: error: expected ‘)’ before numeric constant
29 | RTAPI_MP_ARRAY_STRING(board_ip, 1, "ip address of ethernet board");
| ^~
| )
/tmp/tmpCaSFMZ/colorcnc.c:32:25: error: expected ‘)’ before string constant
32 | RTAPI_MP_INT(speedrange, "Speed range 0..3");
| ^~~~~~~~~~~~~~~~~~~
| )
/tmp/tmpCaSFMZ/colorcnc.c: In function ‘rtapi_app_main’:
/tmp/tmpCaSFMZ/colorcnc.c:504:75: warning: passing argument 2 of ‘hal_param_u32_newf’ from incompatible pointer type [-Wincompatible-pointer-types]
504 | r = hal_param_u32_newf(HAL_RO,((char*)&(device_data->rcvd_pos[i]))+4, comp_id, "colorcnc.%d.stepgen.%01d.rcvd_position_msb", 1, i);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
| |
| char *
In file included from /tmp/tmpCaSFMZ/colorcnc.c:8:
/usr/include/linuxcnc/hal.h:547:17: note: expected ‘volatile hal_u32_t *’ {aka ‘volatile unsigned int *’} but argument is of type ‘char *’
547 | hal_u32_t * data_addr, int comp_id, const char *fmt, ...)
| ~~~~~~~~~~~~^~~~~~~~~
/tmp/tmpCaSFMZ/colorcnc.c:507:39: warning: passing argument 2 of ‘hal_param_u32_newf’ from incompatible pointer type [-Wincompatible-pointer-types]
507 | r = hal_param_u32_newf(HAL_RO,&(device_data->rcvd_pos[i]), comp_id, "colorcnc.%d.stepgen.%01d.rcvd_position_lsb", 1, i);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| __u64 * {aka long long unsigned int *}
In file included from /tmp/tmpCaSFMZ/colorcnc.c:8:
/usr/include/linuxcnc/hal.h:547:17: note: expected ‘volatile hal_u32_t *’ {aka ‘volatile unsigned int *’} but argument is of type ‘__u64 *’ {aka ‘long long unsigned int *’}
547 | hal_u32_t * data_addr, int comp_id, const char *fmt, ...)
| ~~~~~~~~~~~~^~~~~~~~~
/tmp/tmpCaSFMZ/colorcnc.c:558:82: warning: too many arguments for format [-Wformat-extra-args]
558 | retval = hal_param_u32_newf(HAL_RW, &(device_data-> stepgen_steplen), comp_id, "colorcnc.%d.stepgen.steplen", 1, i);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/tmpCaSFMZ/colorcnc.c:565:82: warning: too many arguments for format [-Wformat-extra-args]
565 | retval = hal_param_u32_newf(HAL_RW, &(device_data-> stepgen_dirtime), comp_id, "colorcnc.%d.stepgen.dirtime", 1, i);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/tmpCaSFMZ/colorcnc.c:638:14: warning: implicit declaration of function ‘hal_export_funct’ [-Wimplicit-function-declaration]
638 | retval = hal_export_funct(name, update_port, device_data, 1, 0,comp_id);
| ^~~~~~~~~~~~~~~~
/tmp/tmpCaSFMZ/colorcnc.c:653:22: warning: passing argument 1 of ‘eb_fill_readwrite32’ discards ‘volatile’ qualifier from pointer target type [-Wdiscarded-qualifiers]
653 | eb_fill_readwrite32(wb_wr_buffer, 0, 0x0, 1);
| ^~~~~~~~~~~~
/tmp/tmpCaSFMZ/colorcnc.c:96:33: note: expected ‘uint8_t *’ {aka ‘unsigned char *’} but argument is of type ‘volatile __u8 *’ {aka ‘volatile unsigned char *’}
96 | int eb_fill_readwrite32(uint8_t wb_buffer[20], uint32_t data, uint32_t address, int is_read) {
| ~~~~~~~~^~~~~~~~~~~~~
/tmp/tmpCaSFMZ/colorcnc.c:659:29: warning: passing argument 2 of ‘eb_send’ discards ‘volatile’ qualifier from pointer target type [-Wdiscarded-qualifiers]
659 | r=eb_send(device_data->eb, wb_wr_buffer, 24);
| ^~~~~~~~~~~~
/tmp/tmpCaSFMZ/colorcnc.c:137:53: note: expected ‘const void *’ but argument is of type ‘volatile __u8 *’ {aka ‘volatile unsigned char *’}
137 | int eb_send(struct eb_connection *conn, const void *bytes, size_t len) {
| ~~~~~~~~~~~~^~~~~
/tmp/tmpCaSFMZ/colorcnc.c:662:40: warning: passing argument 2 of ‘eb_recv’ discards ‘volatile’ qualifier from pointer target type [-Wdiscarded-qualifiers]
662 | int count = eb_recv(device_data->eb, wb_rd_buffer, sizeof(wb_rd_buffer));
| ^~~~~~~~~~~~
/tmp/tmpCaSFMZ/colorcnc.c:143:47: note: expected ‘void *’ but argument is of type ‘volatile __u8 *’ {aka ‘volatile unsigned char *’}
143 | int eb_recv(struct eb_connection *conn, void *bytes, size_t max_len) {
| ~~~~~~^~~~~
/tmp/tmpCaSFMZ/colorcnc.c: In function ‘update_port’:
/tmp/tmpCaSFMZ/colorcnc.c:887:29: warning: passing argument 1 of ‘eb_fill_readwrite32’ discards ‘volatile’ qualifier from pointer target type [-Wdiscarded-qualifiers]
887 | eb_fill_readwrite32(wb_wr_buffer, 0, 0x0, 1);
| ^~~~~~~~~~~~
/tmp/tmpCaSFMZ/colorcnc.c:96:33: note: expected ‘uint8_t *’ {aka ‘unsigned char *’} but argument is of type ‘volatile __u8 *’ {aka ‘volatile unsigned char *’}
96 | int eb_fill_readwrite32(uint8_t wb_buffer[20], uint32_t data, uint32_t address, int is_read) {
| ~~~~~~~~^~~~~~~~~~~~~
/tmp/tmpCaSFMZ/colorcnc.c:899:24: warning: initialization of ‘__u32 *’ {aka ‘unsigned int *’} from incompatible pointer type ‘pack_mainW_t *’ [-Wincompatible-pointer-types]
899 | __u32* tmp_ptr=&send_payload;
| ^
/tmp/tmpCaSFMZ/colorcnc.c:899:9: warning: converting a packed ‘pack_mainW_t’ pointer (alignment 1) to a ‘__u32’ {aka ‘unsigned int’} pointer (alignment 4) may result in an unaligned pointer value [-Waddress-of-packed-member]
899 | __u32* tmp_ptr=&send_payload;
| ^~~~~
In file included from /tmp/tmpCaSFMZ/colorcnc.c:12:
/temp/src/colorcnc/colorcnc.h:185:9: note: defined here
185 | typedef struct __attribute__ ((packed)) {
| ^~~~~~
/tmp/tmpCaSFMZ/colorcnc.c:916:38: warning: passing argument 2 of ‘eb_send’ discards ‘volatile’ qualifier from pointer target type [-Wdiscarded-qualifiers]
916 | res=eb_send(device_data->eb, wb_wr_buffer, num_records_to_write*4+16);
| ^~~~~~~~~~~~
/tmp/tmpCaSFMZ/colorcnc.c:137:53: note: expected ‘const void *’ but argument is of type ‘volatile __u8 *’ {aka ‘volatile unsigned char *’}
137 | int eb_send(struct eb_connection *conn, const void *bytes, size_t len) {
| ~~~~~~~~~~~~^~~~~
/tmp/tmpCaSFMZ/colorcnc.c:920:16: warning: passing argument 1 of ‘memset’ discards ‘volatile’ qualifier from pointer target type [-Wdiscarded-qualifiers]
920 | memset(wb_wr_buffer,0,sizeof(wb_wr_buffer));
| ^~~~~~~~~~~~
In file included from /usr/include/features.h:469,
from /usr/include/ctype.h:25,
from /usr/include/linuxcnc/rtapi_ctype.h:19,
from /tmp/tmpCaSFMZ/colorcnc.c:5:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:57:1: note: expected ‘void *’ but argument is of type ‘volatile __u8 *’ {aka ‘volatile unsigned char *’}
57 | __NTH (memset (void *__dest, int __ch, size_t __len))
| ^~~~~
/tmp/tmpCaSFMZ/colorcnc.c:922:29: warning: passing argument 1 of ‘eb_fill_readwrite32’ discards ‘volatile’ qualifier from pointer target type [-Wdiscarded-qualifiers]
922 | eb_fill_readwrite32(wb_wr_buffer, 0, 0x0, 1);
| ^~~~~~~~~~~~
/tmp/tmpCaSFMZ/colorcnc.c:96:33: note: expected ‘uint8_t *’ {aka ‘unsigned char *’} but argument is of type ‘volatile __u8 *’ {aka ‘volatile unsigned char *’}
96 | int eb_fill_readwrite32(uint8_t wb_buffer[20], uint32_t data, uint32_t address, int is_read) {
| ~~~~~~~~^~~~~~~~~~~~~
/tmp/tmpCaSFMZ/colorcnc.c:938:38: warning: passing argument 2 of ‘eb_send’ discards ‘volatile’ qualifier from pointer target type [-Wdiscarded-qualifiers]
938 | res=eb_send(device_data->eb, wb_wr_buffer, num_records_to_read*4+16);
| ^~~~~~~~~~~~
/tmp/tmpCaSFMZ/colorcnc.c:137:53: note: expected ‘const void *’ but argument is of type ‘volatile __u8 *’ {aka ‘volatile unsigned char *’}
137 | int eb_send(struct eb_connection *conn, const void *bytes, size_t len) {
| ~~~~~~~~~~~~^~~~~
/tmp/tmpCaSFMZ/colorcnc.c:942:46: warning: passing argument 2 of ‘eb_recv’ discards ‘volatile’ qualifier from pointer target type [-Wdiscarded-qualifiers]
942 | int count = eb_recv(device_data->eb, wb_rd_buffer, sizeof(wb_rd_buffer));
| ^~~~~~~~~~~~
/tmp/tmpCaSFMZ/colorcnc.c:143:47: note: expected ‘void *’ but argument is of type ‘volatile __u8 *’ {aka ‘volatile unsigned char *’}
143 | int eb_recv(struct eb_connection *conn, void *bytes, size_t max_len) {
| ~~~~~~^~~~~
make: *** [Makefile:2: colorcnc] Błąd 1