I have Am-1808, and i need to boot from usb instead of sd-card as explained here. Previously i was using Davinci-PSP-SDK-03.21.00.4, but the uboot of this psp don't have usb support (i confirmed this by typing 'help' in the uboot menu and it didn't have 'usb' command available). So i downloaded u-boot from denx tree which had 'usb 'command in the u-boot menu and then i added the usb configurations in the da850evm.h as suggested by Ti employee. Here's the configuration:
/*
* USB configuration
*/
#define CONFIG_USB_DA8XX /* Platform hookup to MUSB controller */
#define CONFIG_MUSB_UDC
#ifdef CONFIG_USB_DA8XX
#ifdef CONFIG_MUSB_HCD /* include support for usb host */
#define CONFIG_CMD_USB /* include support for usb cmd */
#define CONFIG_USB_STORAGE /* MSC class support */
#define CONFIG_CMD_STORAGE /* inclue support for usb-storage cmd */
#define CONFIG_CMD_FAT /* inclue support for FAT/storage */
#define CONFIG_DOS_PARTITION /* inclue support for FAT/storage */
#ifdef CONFIG_USB_KEYBOARD /* HID class support */
#define CONFIG_SYS_USB_EVENT_POLL
#define CONFIG_PREBOOT "usb start"
#endif /* CONFIG_USB_KEYBOARD */
#endif /* CONFIG_MUSB_HCD */
#ifdef CONFIG_MUSB_UDC
/* USB device configuration */
#define CONFIG_USB_DEVICE 1
#define CONFIG_USB_TTY 1
#define CONFIG_SYS_CONSOLE_IS_IN_ENV 1
/* Change these to suit your needs */
#define CONFIG_USBD_VENDORID 0x0451
#define CONFIG_USBD_PRODUCTID 0x5678
#define CONFIG_USBD_MANUFACTURER "Texas Instruments"
#define CONFIG_USBD_PRODUCT_NAME "DA830EVM"
#endif /* CONFIG_MUSB_UDC */
#endif /* CONFIG_USB_DA8XX */
And on compiling i get these errors:
usbtty.c:126: error: 'EP0_MAX_PACKET_SIZE' undeclared here (not in a function)
usbtty.c:219: error: 'UDC_INT_ENDPOINT' undeclared here (not in a function)
usbtty.c:222: error: 'UDC_INT_PACKET_SIZE' undeclared here (not in a function)
usbtty.c:245: error: 'UDC_OUT_ENDPOINT' undeclared here (not in a function)
usbtty.c:249: error: 'UDC_BULK_PACKET_SIZE' undeclared here (not in a function)
usbtty.c:256: error: 'UDC_IN_ENDPOINT' undeclared here (not in a function)
usbtty.c:328: error: 'UDC_OUT_PACKET_SIZE' undeclared here (not in a function)
usbtty.c:338: error: 'UDC_IN_PACKET_SIZE' undeclared here (not in a function)
usbtty.c: In function 'usbtty_tstc':
usbtty.c:399: warning: implicit declaration of function 'udc_unset_nak'
usbtty.c: In function 'usbtty_getc':
usbtty.c:424: warning: implicit declaration of function 'udc_set_nak'
usbtty.c: In function 'drv_usbtty_init':
usbtty.c:553: warning: implicit declaration of function 'udc_init'
usbtty.c:560: warning: implicit declaration of function 'udc_startup_events'
usbtty.c:561: warning: implicit declaration of function 'udc_connect'
usbtty.c: In function 'usbtty_init_instances':
usbtty.c:683: warning: implicit declaration of function 'udc_setup_ep'
usbtty.c: In function 'write_buffer':
usbtty.c:846: warning: implicit declaration of function 'udc_endpoint_write'
usbtty.c: In function 'usbtty_poll':
usbtty.c:989: warning: implicit declaration of function 'udc_irq'
make[1]: *** [usbtty.o] Error 1
make[1]: Leaving directory `/home/user/Desktop/Uboot_Screwed/u-boot- omapl1/drivers/serial'
make: *** [drivers/serial/libserial.a] Error 2
If u can please tell how can i get rid of these errors, [I have googled it but didn't find anything useful] or if u can please give me a link of u-boot for Am-1808 which has 'usb' command supported in the u-boot menu.
Update:
I defined CONFIG_USB_TTY in the da850evm.h as auselen pointed, now i am able to resolve previous errors, but i am getting new errors, here's the output of the terminal:
drivers/serial/libserial.a(usbtty.o): In function `write_buffer':
/home/user/Desktop/Uboot_Screwed/u-boot-omapl1/drivers/serial/usbtty.c:846: undefined reference to `udc_endpoint_write'
/home/user/Desktop/Uboot_Screwed/u-boot-omapl1/drivers/serial/usbtty.c:890: undefined reference to `udc_endpoint_write'
drivers/serial/libserial.a(usbtty.o): In function `usbtty_poll':
/home/user/Desktop/Uboot_Screwed/u-boot-omapl1/drivers/serial/usbtty.c:989: undefined reference to `udc_irq'
/home/user/Desktop/Uboot_Screwed/u-boot-omapl1/drivers/serial/usbtty.c:999: undefined reference to `udc_irq'
/home/user/Desktop/Uboot_Screwed/u-boot-omapl1/drivers/serial/usbtty.c:1009: undefined reference to `udc_irq'
drivers/serial/libserial.a(usbtty.o): In function `usbtty_init_endpoints':
/home/user/Desktop/Uboot_Screwed/u-boot-omapl1/drivers/serial/usbtty.c:727: undefined reference to `udc_setup_ep'
/home/user/Desktop/Uboot_Screwed/u-boot-omapl1/drivers/serial/usbtty.c:727: undefined reference to `udc_setup_ep'
/home/user/Desktop/Uboot_Screwed/u-boot-omapl1/drivers/serial/usbtty.c:727: undefined reference to `udc_setup_ep'
drivers/serial/libserial.a(usbtty.o): In function `drv_usbtty_init':
/home/user/Desktop/Uboot_Screwed/u-boot-omapl1/drivers/serial/usbtty.c:553: undefined reference to `udc_init'
drivers/serial/libserial.a(usbtty.o): In function `usbtty_init_instances':
/home/user/Desktop/Uboot_Screwed/u-boot-omapl1/drivers/serial/usbtty.c:683: undefined reference to `udc_setup_ep'
drivers/serial/libserial.a(usbtty.o): In function `drv_usbtty_init':
/home/user/Desktop/Uboot_Screwed/u-boot-omapl1/drivers/serial/usbtty.c:560: undefined reference to `udc_startup_events'
/home/user/Desktop/Uboot_Screwed/u-boot-omapl1/drivers/serial/usbtty.c:561: undefined reference to `udc_connect'
drivers/serial/libserial.a(usbtty.o): In function `usbtty_tstc':
/home/user/Desktop/Uboot_Screwed/u-boot-omapl1/drivers/serial/usbtty.c:399: undefined reference to `udc_unset_nak'
drivers/serial/libserial.a(usbtty.o): In function `usbtty_getc':
/home/user/Desktop/Uboot_Screwed/u-boot-omapl1/drivers/serial/usbtty.c:419: undefined reference to `udc_unset_nak'
/home/user/Desktop/Uboot_Screwed/u-boot-omapl1/drivers/serial/usbtty.c:424: undefined reference to `udc_set_nak'
lib_arm/libarm.a(bootm.o): In function `do_bootm_linux':
/home/user/Desktop/Uboot_Screwed/u-boot-omapl1/lib_arm/bootm.c:122: undefined reference to `udc_disconnect'
Any idea how can i fix them ?
Thanks
Regards
usama
It looks like you need to define/enable CONFIG_USB_TTY.
Related
I'm trying to write a test program using windows.h. I have a simple main function with a function in it and doesn't work when I compile it:
#include <windows.h>
#include <stdio.h>
int main(){
COORD coords;
SetConsoleDisplayMode(GetStdHandle(STD_OUTPUT_HANDLE), CONSOLE_FULLSCREEN_MODE, &coords);
return 0;
}
But when I compile it using "mingw32-gcc main.c" i get:
main.c: In function 'main':
main.c:107:5: warning: implicit declaration of function 'SetConsoleDisplayMode' [-Wimplicit-function-declaration]
SetConsoleDisplayMode(GetStdHandle(STD_OUTPUT_HANDLE), CONSOLE_FULLSCREEN_MODE, &coords);
^~~~~~~~~~~~~~~~~~~~~
main.c:107:60: error: 'CONSOLE_FULLSCREEN_MODE' undeclared (first use in this function)
SetConsoleDisplayMode(GetStdHandle(STD_OUTPUT_HANDLE), CONSOLE_FULLSCREEN_MODE, &coords);
^~~~~~~~~~~~~~~~~~~~~~~
main.c:107:60: note: each undeclared identifier is reported only once for each function
(It says it's in line 107 because I wrote additional functions that does not need windows.h and don't cause trouble as I don't use them, also they are commented)
I am trying to use some old devices called sensinodes . There are a couple of pieces of software needed for this, contiki, sdcc and the some nano_usb_programmer
I'm working from these instruction and I can't seem to make the nano_usb_programmer on ubuntu 16.04 LTS as this pretty old now and things have moved on.
https://github.com/avian2/contiki
When making the nano element I get the error *Edited
In file included from main.c:17:0:
opts.h:25:2: error: redefinition of typedef ‘mode_t’ with different type
}mode_t;
^
In file included from /usr/include/stdlib.h:314:0,
from main.c:10:
/usr/include/x86_64-linux-gnu/sys/types.h:70:18: note: previous declaration of ‘mode_t’ was here
typedef __mode_t mode_t;
^
main.c: In function ‘main’:
main.c:57:6: warning: implicit declaration of function ‘opts_parse’ [-Wimplicit-function-declaration]
if (opts_parse(argc, argv) < 0)
^
main.c:77:4: warning: implicit declaration of function ‘prog_scan’ [-Wimplicit-function-declaration]
prog_scan();
^
main.c:178:7: warning: implicit declaration of function ‘hexfile_out’ [-Wimplicit-function-declaration]
hexfile_out(line_data, 0x04, 0, ptr, 2);
^
main.c:220:15: warning: implicit declaration of function ‘hexfile_build_tables’ [-Wimplicit-function-declaration]
if((rval = hexfile_build_tables(opts.filename, page_buffer, page_table)) == -1)
^
main.c:231:4: warning: implicit declaration of function ‘hexfile_program’ [-Wimplicit-function-declaration]
hexfile_program(page_buffer, page_table);
^
Makefile:25: recipe for target 'main.o' failed
make: *** [main.o] Error 1
It is pointing to line 25 the following file, my c knowledge just isn't any where near good enough to fix this. Any help would be great.
/*
* opts.h
*
* Created on: Dec 21, 2009
* Author: martti
*/
#ifndef OPTS_H_
#define OPTS_H_
#include "cdi.h"
typedef enum
{
USAGE,
VERSION,
SCAN,
WRITE,
WRITE_FAST,
READ,
WRITE_MAC,
READ_MAC,
LOCK,
ERASE
}mode_t;
typedef struct opts_t
{
int port;
chip_t chip;
mode_t mode;
uint8_t write_mac[8];
ramcode_t code_in_ram;
char *filename;
}opts_t;
extern opts_t opts;
#endif /* OPTS_H_ */
I am getting a linking error because a function is declared in a .h file but its definition is commented.
Below is the linking error:
--- Linking Error ---
Error: L6218E: Undefined symbol clk_SetHMSSAPMFreqPlan (referred
from VVDRV_clk_glue.o).
Now, the file where the function is being called has multiple nested if blocks like below:
#if defined(COMPILING_APPS_PROC) || defined(COMPILING_SPM_PROC)
#ifndef AXF_BUILD
eClkResult clk_SetFreqPlan(eClockFrequencyType eFreqPlan, uint32 eSubsystemLists) {
----some code----
#if defined(COMPILING_APPS_PROC) && !defined(AXF_BUILD)
clk_SetHMSSAPMFreqPlan(0, eFreqPlan); /* This function is giving a linking error */
#endif
#endif /*AXF_BUILD*/
#endif /*COMPILING_APPS_PROC*/
To get over the linking error, on top of the file I am declaring the macro:
#ifndef AXF_BUILD
#define AXF_BUILD 1
#endif
Because the other macro COMPILING_APPS_PROC has to be kept defined, I cannot change it.
Since, AXF_BUILD is now defined, I am expecting the function clk_SetHMSSAPMFreqPlan(0, eFreqPlan) will not be compiled and compilation should be clean. But, I am still getting the same linking error. What might be the reason?
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 8 years ago.
Improve this question
Following this article, I am trying to get a C program to compile that uses TPC_REPAIR.
http://oroboro.com/dealing-with-network-port-abuse-in-sockets-in-c/
TCP_REPAIR is defined in
/usr/src/linux-headers-3.8.0-29/include/uapi/linux/tcp.h
Including this header conflicts with the ones required for other socket APIs.
Here's my code
#include <stdio.h>
#include <unistd.h>
#include <linux/socket.h>
#include <uapi/linux/in.h>
#include <netinet/tcp.h>
#include "/usr/src/linux-headers-3.8.0-29/include/uapi/linux/tcp.h"
int main(int argc, char* argv[])
{
int cfd;
struct sockaddr_in addr;
char ch='r';
cfd=socket(AF_INET, SOCK_STREAM, 0);
addr.sin_family=AF_INET;
addr.sin_addr.s_addr=inet_addr("10.160.102.40");
addr.sin_port=htons(9988);
if(connect(cfd, (struct sockaddr *)&addr,
sizeof(addr))<0) {
perror("connect error");
return -1;
}
if(write(cfd, &ch, 1)<0) perror("write");
if(read(cfd, &ch, 1)<0) perror("read");
printf("\nReply from Server: %c\n",ch);
//close(cfd);
int aux = 1;
if(setsockopt(cfd, SOL_TCP, TCP_REPAIR, &aux, sizeof( aux )) < 0 )
{
perror( "could not turn on repair mode" );
}
return 0;
}
And here's gcc output
In file included from /usr/include/netinet/tcp.h:56:0,
from new_client.c:5:
/usr/include/x86_64-linux-gnu/sys/types.h:45:18: error: conflicting types for ‘loff_t’
/usr/src/linux-headers-3.8.0-29-generic/include/linux/types.h:45:26: note: previous declaration of ‘loff_t’ was here
/usr/include/x86_64-linux-gnu/sys/types.h:61:17: error: conflicting types for ‘dev_t’
/usr/src/linux-headers-3.8.0-29-generic/include/linux/types.h:15:25: note: previous declaration of ‘dev_t’ was here
/usr/include/x86_64-linux-gnu/sys/types.h:76:19: error: conflicting types for ‘nlink_t’
/usr/src/linux-headers-3.8.0-29-generic/include/linux/types.h:19:17: note: previous declaration of ‘nlink_t’ was here
In file included from /usr/include/x86_64-linux-gnu/sys/types.h:133:0,
from /usr/include/netinet/tcp.h:56,
from new_client.c:5:
/usr/include/time.h:104:19: error: conflicting types for ‘timer_t’
/usr/src/linux-headers-3.8.0-29-generic/include/linux/types.h:25:26: note: previous declaration of ‘timer_t’ was here
In file included from /usr/include/netinet/tcp.h:56:0,
from new_client.c:5:
/usr/include/x86_64-linux-gnu/sys/types.h:198:1: error: conflicting types for ‘int64_t’
/usr/src/linux-headers-3.8.0-29-generic/include/linux/types.h:113:17: note: previous declaration of ‘int64_t’ was here
/usr/include/x86_64-linux-gnu/sys/types.h:204:1: error: conflicting types for ‘u_int64_t’
/usr/src/linux-headers-3.8.0-29-generic/include/linux/types.h:112:17: note: previous declaration of ‘u_int64_t’ was here
In file included from /usr/include/x86_64-linux-gnu/sys/types.h:220:0,
from /usr/include/netinet/tcp.h:56,
from new_client.c:5:
/usr/include/x86_64-linux-gnu/sys/select.h:76:5: error: conflicting types for ‘fd_set’
/usr/src/linux-headers-3.8.0-29-generic/include/linux/types.h:14:26: note: previous declaration of ‘fd_set’ was here
In file included from /usr/include/netinet/tcp.h:56:0,
from new_client.c:5:
/usr/include/x86_64-linux-gnu/sys/types.h:236:20: error: conflicting types for ‘blkcnt_t’
/usr/src/linux-headers-3.8.0-29-generic/include/linux/types.h:134:23: note: previous declaration of ‘blkcnt_t’ was here
In file included from /usr/include/x86_64-linux-gnu/sys/uio.h:29:0,
from /usr/include/x86_64-linux-gnu/sys/socket.h:28,
from /usr/include/netinet/tcp.h:57,
from new_client.c:5:
/usr/include/x86_64-linux-gnu/bits/uio.h:44:8: error: redefinition of ‘struct iovec’
/usr/src/linux-headers-3.8.0-29-generic/include/uapi/linux/uio.h:16:8: note: originally defined here
In file included from /usr/include/x86_64-linux-gnu/sys/socket.h:40:0,
from /usr/include/netinet/tcp.h:57,
from new_client.c:5:
/usr/include/x86_64-linux-gnu/bits/socket.h:180:8: error: redefinition of ‘struct sockaddr’
/usr/src/linux-headers-3.8.0-29-generic/include/uapi/linux/socket.h:19:27: note: originally defined here
/usr/include/x86_64-linux-gnu/bits/socket.h:193:8: error: redefinition of ‘struct __kernel_sockaddr_storage’
/usr/src/linux-headers-3.8.0-29-generic/include/uapi/linux/socket.h:13:8: note: originally defined here
/usr/include/x86_64-linux-gnu/bits/socket.h:204:5: error: expected identifier before numeric constant
/usr/include/x86_64-linux-gnu/bits/socket.h:253:8: error: redefinition of ‘struct msghdr’
/usr/src/linux-headers-3.8.0-29-generic/include/linux/socket.h:47:8: note: originally defined here
/usr/include/x86_64-linux-gnu/bits/socket.h:280:8: error: redefinition of ‘struct cmsghdr’
/usr/src/linux-headers-3.8.0-29-generic/include/linux/socket.h:69:8: note: originally defined here
/usr/include/x86_64-linux-gnu/bits/socket.h:310:24: error: conflicting types for ‘__cmsg_nxthdr’
/usr/src/linux-headers-3.8.0-29-generic/include/linux/socket.h:111:32: note: previous definition of ‘__cmsg_nxthdr’ was here
/usr/include/x86_64-linux-gnu/bits/socket.h:339:5: error: expected identifier before numeric constant
In file included from /usr/include/x86_64-linux-gnu/sys/socket.h:40:0,
from /usr/include/netinet/tcp.h:57,
from new_client.c:5:
/usr/include/x86_64-linux-gnu/bits/socket.h:417:8: error: redefinition of ‘struct linger’
/usr/src/linux-headers-3.8.0-29-generic/include/linux/socket.h:34:8: note: originally defined here
In file included from new_client.c:6:0:
/usr/src/linux-headers-3.8.0-29/include/uapi/linux/tcp.h:24:8: error: redefinition of ‘struct tcphdr’
/usr/include/netinet/tcp.h:92:8: note: originally defined here
/usr/src/linux-headers-3.8.0-29/include/uapi/linux/tcp.h:135:6: error: nested redefinition of ‘enum tcp_ca_state’
/usr/src/linux-headers-3.8.0-29/include/uapi/linux/tcp.h:135:6: error: redeclaration of ‘enum tcp_ca_state’
/usr/include/netinet/tcp.h:179:6: note: originally defined here
/usr/src/linux-headers-3.8.0-29/include/uapi/linux/tcp.h:136:2: error: redeclaration of enumerator ‘TCP_CA_Open’
/usr/include/netinet/tcp.h:181:3: note: previous definition of ‘TCP_CA_Open’ was here
/usr/src/linux-headers-3.8.0-29/include/uapi/linux/tcp.h:138:2: error: redeclaration of enumerator ‘TCP_CA_Disorder’
/usr/include/netinet/tcp.h:182:3: note: previous definition of ‘TCP_CA_Disorder’ was here
/usr/src/linux-headers-3.8.0-29/include/uapi/linux/tcp.h:140:2: error: redeclaration of enumerator ‘TCP_CA_CWR’
/usr/include/netinet/tcp.h:183:3: note: previous definition of ‘TCP_CA_CWR’ was here
/usr/src/linux-headers-3.8.0-29/include/uapi/linux/tcp.h:142:2: error: redeclaration of enumerator ‘TCP_CA_Recovery’
/usr/include/netinet/tcp.h:184:3: note: previous definition of ‘TCP_CA_Recovery’ was here
/usr/src/linux-headers-3.8.0-29/include/uapi/linux/tcp.h:144:2: error: redeclaration of enumerator ‘TCP_CA_Loss’
/usr/include/netinet/tcp.h:185:3: note: previous definition of ‘TCP_CA_Loss’ was here
/usr/src/linux-headers-3.8.0-29/include/uapi/linux/tcp.h:148:8: error: redefinition of ‘struct tcp_info’
/usr/include/netinet/tcp.h:188:8: note: originally defined here
/usr/src/linux-headers-3.8.0-29/include/uapi/linux/tcp.h:193:8: error: redefinition of ‘struct tcp_md5sig’
/usr/include/netinet/tcp.h:235:8: note: originally defined here
This is really not useful
#include "/usr/src/linux-headers-3.8.0-29/include/uapi/linux/tcp.h"
Because either the kernel supports it or it does not. You can check for it like this:
find /usr/include -type f -exec grep TCP_REPAIR {} /dev/null \;
/usr/include/linux/tcp.h:#define TCP_REPAIR 19 /* TCP sock is under repair right now */
/usr/include/linux/tcp.h:#define TCP_REPAIR_QUEUE 20
/usr/include/linux/tcp.h:#define TCP_REPAIR_OPTIONS 22
if it's there, great, otherwise you'll have to use the workaround.
Here's an Ubuntu that has it
lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 12.10
Release: 12.10
Codename: quantal
It looks like SOL_TCP is only defined in /usr/include/netinet/tcp.h
find /usr/include -type f -exec grep SOL_TCP {} /dev/null \;
/usr/include/netinet/tcp.h:# define SOL_TCP 6 /* TCP level */
To overcome the unfortunate absence of SOL_TCP in /usr/include/linux/tcp.h. You can try to simply copy it from netinet/tcp.h, it's just a number after all.
#ifndef SOL_TCP
#define SOL_TCP 6
#endif
However, the man page of setsockopt offers an even better approach:
To manipulate options at any other level the protocol number of the appropriate protocol controlling the option is supplied. For example, to indicate that an option is to be interpreted by the TCP protocol, level should be set to the protocol number of TCP; see getprotoent(3).
What does the following error mean when compiling.
Tilemap.h:21: error: conflicting types for ‘ThreeDWorld’
Tilemap.h:21: error: previous declaration of ‘ThreeDWorld’ was here
Tilemap.h:29: error: conflicting types for ‘CGPoint’
Tilemap.h:29: error: previous declaration of ‘CGPoint’ was here
Tilemap.h:31: error: conflicting types for ‘tileForCoordinates’
Tilemap.h:31: error: previous declaration of ‘tileForCoordinates’ was here
Why is it giving an error for what was there?My source file has one instance of it as such
typedef struct
{
int xPosition;
int yPosition;
}
CGPoint;
Are you including the header file from more than one place? Use a guard in the header file, if so.
For example, in Tilemap.h:
#ifndef TILEMAP_H
#define TILEMAP_H
// header file contents
#endif /* TILEMAP_H */
Stick some inclusion guards on your headers.
Your type definition is appearing more than once in your compilation unit.
You included the header file twice.
In my own code, I wrapped all header files with
#ifndef HEADER_FILE_NAME
#define HEADER_FILE_NAME
#endif
to avoid such errors.