Skip to content

lwIP, linker error with PPP enabled #2272

@TheRealZago

Description

@TheRealZago

When compiling a basic application with PPP enabled and support for authentication (PAP, CHAP and friends), the linker fails with the following error:

/Applications/ArmGNUToolchain/13.3.rel1/arm-none-eabi/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/bin/ld: CMakeFiles/PicoModem.dir/Users/zago/repo/pico-sdk/lib/lwip/src/netif/ppp/magic.c.o: in function `magic_churnrand':
[build] /Users/zago/repo/pico-sdk/lib/lwip/src/netif/ppp/magic.c:118:(.text.magic_churnrand+0x30): undefined reference to `sys_jiffies'

My lwipopts.h is loosely based on the file provided by the pico_w examples, with just a few additions:

#define NO_SYS 1
// ... omissis ...
#define PPP_SUPPORT 1
#define PAP_SUPPORT 1
#define CHAP_SUPPORT 1
#define MSCHAP_SUPPORT 1
#define PPP_SERVER 1

"HAL" is being provided by linking against pico_lwip_nosys.

Workaround

I've noticed pico_lwip_nosys already defines sys_now(), so I've exteded its job by adding my own library hook function in a dedicated source file.

// @file libhooks.c

#include "lwip/sys.h"
#include "hardware/timer.h"

u32_t sys_jiffies(void)
{
    return time_us_32();
}

Should I open a pull request with a cleaner SDK-side correction?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions