[PATCH v5 2/4] button: add a simple Analog to Digital Converter device based button driver

Marek Szyprowski m.szyprowski at samsung.com
Mon Feb 8 17:10:10 CET 2021


Hi Simon,

On 06.02.2021 17:21, Simon Glass wrote:
> On Thu, 4 Feb 2021 at 03:36, Marek Szyprowski <m.szyprowski at samsung.com> wrote:
>> ...
>> Could you give me a bit more hints or point where to start? I've tried
>> to build sandbox, but it fails for v2021.01 release (I've did make
>> sandbox_defconfig && make all). I assume I would need to add adc and
>> adc-keys devices to some sandbox dts and some code triggering and
>> checking the key values, but that's all I know now.
> Well you do need to be able to build sandbox or you will get
> nowhere...what error did you get? Once we understand what went wrong
> we can update the docs. Maybe it is missing a dependency.

$ gcc --version
gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ git checkout v2021.01

$ make sandbox_defconfig
#
# configuration written to .config
#

$ make
scripts/kconfig/conf  --syncconfig Kconfig
   CFG     u-boot.cfg
   GEN     include/autoconf.mk
   GEN     include/autoconf.mk.dep
   CFGCHK  u-boot.cfg
   UPD     include/generated/timestamp_autogenerated.h
   HOSTCC  tools/mkenvimage.o
   HOSTLD  tools/mkenvimage
   HOSTCC  tools/fit_image.o
   HOSTCC  tools/image-host.o
   HOSTCC  tools/dumpimage.o
   HOSTLD  tools/dumpimage
   HOSTCC  tools/mkimage.o
   HOSTLD  tools/mkimage
   HOSTLD  tools/fit_info
   HOSTLD  tools/fit_check_sign

...

   CC      arch/sandbox/cpu/cpu.o
In file included from include/common.h:26:0,
                  from arch/sandbox/cpu/cpu.c:6:
include/asm/global_data.h:112:58: warning: call-clobbered register used 
for global register variable
  #define DECLARE_GLOBAL_DATA_PTR  register volatile gd_t *gd asm ("r9")
                                                           ^
include/dm/of.h:86:1: note: in expansion of macro ‘DECLARE_GLOBAL_DATA_PTR’
  DECLARE_GLOBAL_DATA_PTR;
  ^~~~~~~~~~~~~~~~~~~~~~~
In file included from arch/sandbox/cpu/cpu.c:18:0:
./arch/sandbox/include/asm/state.h:98:30: error: 
‘CONFIG_SANDBOX_SPI_MAX_BUS’ undeclared here (not in a function); did 
you mean ‘CONFIG_SANDBOX_SPI’?
   struct sandbox_spi_info spi[CONFIG_SANDBOX_SPI_MAX_BUS]
                               ^~~~~~~~~~~~~~~~~~~~~~~~~~
                               CONFIG_SANDBOX_SPI
./arch/sandbox/include/asm/state.h:99:7: error: 
‘CONFIG_SANDBOX_SPI_MAX_CS’ undeclared here (not in a function); did you 
mean ‘CONFIG_SANDBOX_SPI_MAX_BUS’?
       [CONFIG_SANDBOX_SPI_MAX_CS];
        ^~~~~~~~~~~~~~~~~~~~~~~~~
        CONFIG_SANDBOX_SPI_MAX_BUS
arch/sandbox/cpu/cpu.c: In function ‘is_in_sandbox_mem’:
arch/sandbox/cpu/cpu.c:83:41: error: ‘volatile struct arch_global_data’ 
has no member named ‘ram_buf’
   return (const uint8_t *)ptr >= gd->arch.ram_buf &&
                                          ^
arch/sandbox/cpu/cpu.c:84:34: error: ‘volatile struct arch_global_data’ 
has no member named ‘ram_buf’
    (const uint8_t *)ptr < gd->arch.ram_buf + gd->ram_size;
                                   ^
arch/sandbox/cpu/cpu.c: At top level:
arch/sandbox/cpu/cpu.c:97:7: error: redefinition of ‘phys_to_virt’
  void *phys_to_virt(phys_addr_t paddr)
        ^~~~~~~~~~~~
In file included from include/asm/io.h:495:0,
                  from arch/sandbox/cpu/cpu.c:15:
include/asm-generic/io.h:30:21: note: previous definition of 
‘phys_to_virt’ was here
  static inline void *phys_to_virt(phys_addr_t paddr)
                      ^~~~~~~~~~~~
arch/sandbox/cpu/cpu.c: In function ‘phys_to_virt’:
arch/sandbox/cpu/cpu.c:104:27: error: ‘volatile struct arch_global_data’ 
has no member named ‘ram_buf’
    return (void *)(gd->arch.ram_buf + paddr);
                            ^
In file included from include/linux/posix_types.h:4:0,
                  from include/linux/types.h:4,
                  from include/time.h:7,
                  from include/common.h:18,
                  from arch/sandbox/cpu/cpu.c:6:
include/linux/stddef.h:17:33: warning: cast from pointer to integer of 
different size [-Wpointer-to-int-cast]
  #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
                                  ^
include/linux/kernel.h:274:29: note: in expansion of macro ‘offsetof’
   (type *)( (char *)__mptr - offsetof(type,member) );})
                              ^~~~~~~~
include/linux/list.h:327:2: note: in expansion of macro ‘container_of’
   container_of(ptr, type, member)
   ^~~~~~~~~~~~
include/linux/list.h:424:13: note: in expansion of macro ‘list_entry’
   for (pos = list_entry((head)->next, typeof(*pos), member); \
              ^~~~~~~~~~
arch/sandbox/cpu/cpu.c:111:2: note: in expansion of macro 
‘list_for_each_entry’
   list_for_each_entry(mentry, &state->mapmem_head, sibling_node) {
   ^~~~~~~~~~~~~~~~~~~
include/linux/stddef.h:17:33: warning: cast from pointer to integer of 
different size [-Wpointer-to-int-cast]
  #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
                                  ^
include/linux/kernel.h:274:29: note: in expansion of macro ‘offsetof’
   (type *)( (char *)__mptr - offsetof(type,member) );})
                              ^~~~~~~~
include/linux/list.h:327:2: note: in expansion of macro ‘container_of’
   container_of(ptr, type, member)
   ^~~~~~~~~~~~
include/linux/list.h:426:13: note: in expansion of macro ‘list_entry’
        pos = list_entry(pos->member.next, typeof(*pos), member))
              ^~~~~~~~~~
arch/sandbox/cpu/cpu.c:111:2: note: in expansion of macro 
‘list_for_each_entry’
   list_for_each_entry(mentry, &state->mapmem_head, sibling_node) {
   ^~~~~~~~~~~~~~~~~~~
arch/sandbox/cpu/cpu.c: In function ‘find_tag’:
include/linux/stddef.h:17:33: warning: cast from pointer to integer of 
different size [-Wpointer-to-int-cast]
  #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
                                  ^
include/linux/kernel.h:274:29: note: in expansion of macro ‘offsetof’
   (type *)( (char *)__mptr - offsetof(type,member) );})
                              ^~~~~~~~
include/linux/list.h:327:2: note: in expansion of macro ‘container_of’
   container_of(ptr, type, member)
   ^~~~~~~~~~~~
include/linux/list.h:424:13: note: in expansion of macro ‘list_entry’
   for (pos = list_entry((head)->next, typeof(*pos), member); \
              ^~~~~~~~~~
arch/sandbox/cpu/cpu.c:132:2: note: in expansion of macro 
‘list_for_each_entry’
   list_for_each_entry(mentry, &state->mapmem_head, sibling_node) {
   ^~~~~~~~~~~~~~~~~~~
include/linux/stddef.h:17:33: warning: cast from pointer to integer of 
different size [-Wpointer-to-int-cast]
  #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
                                  ^
include/linux/kernel.h:274:29: note: in expansion of macro ‘offsetof’
   (type *)( (char *)__mptr - offsetof(type,member) );})
                              ^~~~~~~~
include/linux/list.h:327:2: note: in expansion of macro ‘container_of’
   container_of(ptr, type, member)
   ^~~~~~~~~~~~
include/linux/list.h:426:13: note: in expansion of macro ‘list_entry’
        pos = list_entry(pos->member.next, typeof(*pos), member))
              ^~~~~~~~~~
arch/sandbox/cpu/cpu.c:132:2: note: in expansion of macro 
‘list_for_each_entry’
   list_for_each_entry(mentry, &state->mapmem_head, sibling_node) {
   ^~~~~~~~~~~~~~~~~~~
arch/sandbox/cpu/cpu.c: At top level:
arch/sandbox/cpu/cpu.c:142:13: error: redefinition of ‘virt_to_phys’
  phys_addr_t virt_to_phys(void *ptr)
              ^~~~~~~~~~~~
In file included from include/asm/io.h:495:0,
                  from arch/sandbox/cpu/cpu.c:15:
include/asm-generic/io.h:46:27: note: previous definition of 
‘virt_to_phys’ was here
  static inline phys_addr_t virt_to_phys(void *vaddr)
                            ^~~~~~~~~~~~
arch/sandbox/cpu/cpu.c: In function ‘virt_to_phys’:
arch/sandbox/cpu/cpu.c:151:49: error: ‘volatile struct arch_global_data’ 
has no member named ‘ram_buf’
    return (phys_addr_t)((uint8_t *)ptr - gd->arch.ram_buf);
                                                  ^
arch/sandbox/cpu/cpu.c: At top level:
arch/sandbox/cpu/cpu.c:165:7: error: redefinition of ‘map_physmem’
  void *map_physmem(phys_addr_t paddr, unsigned long len, unsigned long 
flags)
        ^~~~~~~~~~~
In file included from include/asm/io.h:495:0,
                  from arch/sandbox/cpu/cpu.c:15:
include/asm-generic/io.h:86:21: note: previous definition of 
‘map_physmem’ was here
  static inline void *map_physmem(phys_addr_t paddr, unsigned long len,
                      ^~~~~~~~~~~
arch/sandbox/cpu/cpu.c: In function ‘map_physmem’:
arch/sandbox/cpu/cpu.c:172:25: warning: implicit declaration of function 
‘pci_map_physmem’; did you mean ‘map_physmem’? 
[-Wimplicit-function-declaration]
   if (enable_pci_map && !pci_map_physmem(paddr, &len, &map_dev, &ptr)) {
                          ^~~~~~~~~~~~~~~
                          map_physmem
arch/sandbox/cpu/cpu.c: At top level:
arch/sandbox/cpu/cpu.c:185:6: error: conflicting types for ‘unmap_physmem’
  void unmap_physmem(const void *ptr, unsigned long flags)
       ^~~~~~~~~~~~~
In file included from include/asm/io.h:495:0,
                  from arch/sandbox/cpu/cpu.c:15:
include/asm-generic/io.h:103:20: note: previous definition of 
‘unmap_physmem’ was here
  static inline void unmap_physmem(void *vaddr, unsigned long flags)
                     ^~~~~~~~~~~~~
arch/sandbox/cpu/cpu.c: In function ‘unmap_physmem’:
arch/sandbox/cpu/cpu.c:189:3: warning: implicit declaration of function 
‘pci_unmap_physmem’; did you mean ‘unmap_physmem’? 
[-Wimplicit-function-declaration]
    pci_unmap_physmem(ptr, map_len, map_dev);
    ^~~~~~~~~~~~~~~~~
    unmap_physmem
arch/sandbox/cpu/cpu.c: In function ‘map_to_sysmem’:
arch/sandbox/cpu/cpu.c:204:30: error: ‘volatile struct arch_global_data’ 
has no member named ‘ram_buf’
    return (u8 *)ptr - gd->arch.ram_buf;
                               ^
arch/sandbox/cpu/cpu.c: At top level:
arch/sandbox/cpu/cpu.c:233:50: warning: ‘enum sandboxio_size_t’ declared 
inside parameter list will not be visible outside of this definition or 
declaration
  unsigned int sandbox_read(const void *addr, enum sandboxio_size_t size)
                                                   ^~~~~~~~~~~~~~~~
arch/sandbox/cpu/cpu.c:233:67: error: parameter 2 (‘size’) has 
incomplete type
  unsigned int sandbox_read(const void *addr, enum sandboxio_size_t size)
^~~~
arch/sandbox/cpu/cpu.c:233:14: warning: function declaration isn’t a 
prototype [-Wstrict-prototypes]
  unsigned int sandbox_read(const void *addr, enum sandboxio_size_t size)
               ^~~~~~~~~~~~
arch/sandbox/cpu/cpu.c: In function ‘sandbox_read’:
arch/sandbox/cpu/cpu.c:241:7: error: ‘SB_SIZE_8’ undeclared (first use 
in this function); did you mean ‘PCI_SIZE_8’?
   case SB_SIZE_8:
        ^~~~~~~~~
        PCI_SIZE_8
arch/sandbox/cpu/cpu.c:241:7: note: each undeclared identifier is 
reported only once for each function it appears in
arch/sandbox/cpu/cpu.c:243:7: error: ‘SB_SIZE_16’ undeclared (first use 
in this function); did you mean ‘SB_SIZE_8’?
   case SB_SIZE_16:
        ^~~~~~~~~~
        SB_SIZE_8
arch/sandbox/cpu/cpu.c:245:7: error: ‘SB_SIZE_32’ undeclared (first use 
in this function); did you mean ‘SB_SIZE_16’?
   case SB_SIZE_32:
        ^~~~~~~~~~
        SB_SIZE_16
arch/sandbox/cpu/cpu.c:247:7: error: ‘SB_SIZE_64’ undeclared (first use 
in this function); did you mean ‘SB_SIZE_32’?
   case SB_SIZE_64:
        ^~~~~~~~~~
        SB_SIZE_32
arch/sandbox/cpu/cpu.c: At top level:
arch/sandbox/cpu/cpu.c:254:55: warning: ‘enum sandboxio_size_t’ declared 
inside parameter list will not be visible outside of this definition or 
declaration
  void sandbox_write(void *addr, unsigned int val, enum sandboxio_size_t 
size)
^~~~~~~~~~~~~~~~
arch/sandbox/cpu/cpu.c:254:72: error: parameter 3 (‘size’) has 
incomplete type
  void sandbox_write(void *addr, unsigned int val, enum sandboxio_size_t 
size)
^~~~
arch/sandbox/cpu/cpu.c:254:6: warning: function declaration isn’t a 
prototype [-Wstrict-prototypes]
  void sandbox_write(void *addr, unsigned int val, enum sandboxio_size_t 
size)
       ^~~~~~~~~~~~~
arch/sandbox/cpu/cpu.c: In function ‘sandbox_write’:
arch/sandbox/cpu/cpu.c:262:7: error: ‘SB_SIZE_8’ undeclared (first use 
in this function); did you mean ‘PCI_SIZE_8’?
   case SB_SIZE_8:
        ^~~~~~~~~
        PCI_SIZE_8
arch/sandbox/cpu/cpu.c:265:7: error: ‘SB_SIZE_16’ undeclared (first use 
in this function); did you mean ‘SB_SIZE_8’?
   case SB_SIZE_16:
        ^~~~~~~~~~
        SB_SIZE_8
arch/sandbox/cpu/cpu.c:268:7: error: ‘SB_SIZE_32’ undeclared (first use 
in this function); did you mean ‘SB_SIZE_16’?
   case SB_SIZE_32:
        ^~~~~~~~~~
        SB_SIZE_16
arch/sandbox/cpu/cpu.c:271:7: error: ‘SB_SIZE_64’ undeclared (first use 
in this function); did you mean ‘SB_SIZE_32’?
   case SB_SIZE_64:
        ^~~~~~~~~~
        SB_SIZE_32
arch/sandbox/cpu/cpu.c: In function ‘sandbox_read_fdt_from_file’:
arch/sandbox/cpu/cpu.c:306:9: warning: implicit declaration of function 
‘map_sysmem’; did you mean ‘map_physmem’? [-Wimplicit-function-declaration]
   blob = map_sysmem(CONFIG_SYS_FDT_LOAD_ADDR, 0);
          ^~~~~~~~~~
          map_physmem
arch/sandbox/cpu/cpu.c:306:7: warning: assignment makes pointer from 
integer without a cast [-Wint-conversion]
   blob = map_sysmem(CONFIG_SYS_FDT_LOAD_ADDR, 0);
        ^
arch/sandbox/cpu/cpu.c: In function ‘is_in_sandbox_mem’:
arch/sandbox/cpu/cpu.c:85:1: warning: control reaches end of non-void 
function [-Wreturn-type]
  }
  ^
scripts/Makefile.build:265: recipe for target 'arch/sandbox/cpu/cpu.o' 
failed
make[1]: *** [arch/sandbox/cpu/cpu.o] Error 1
Makefile:1784: recipe for target 'arch/sandbox/cpu' failed
make: *** [arch/sandbox/cpu] Error 2

Best regards

-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland



More information about the U-Boot mailing list