Developing SIP Phone with GUI on STM32 MCU

Build PJSIP on Linux

$ ./configure --prefix=~/pj_build
$ make dep
$ make

Launch PJSIP on Linux

#define SIP_DOMAIN     ""
#define SIP_USER "alice"
#define SIP_PASSWD "secret"
$ ./pjsip-apps/bin/samples/x86_64-unknown-linux-gnu/simple_pjsua
15:21:22.181            pjsua_acc.c  ....SIP outbound status for acc 0 is not active
15:21:22.181 pjsua_acc.c registration success, status=200 (Registration successful), will re-register in 300 seconds
15:21:22.181 pjsua_acc.c ....Keep-alive timer started for acc 0, destination:, interval:15s

Build PJSIP in Embox

@Build(stage=2,script="$(EXTERNAL_MAKE) PJSIP_ENABLE_CXX=false")
@BuildArtifactPath(cppflags="-I$(abspath $(EXTERNAL_BUILD_DIR))/third_party/pjproject/core/install/include/")module core_c extends core {
depends pjsip_dependencies
#define SIP_DOMAIN  <sip_domain>
#define SIP_USER <sip_user>
#define SIP_PASSWD <sip_passwd>
package project.pjsip.cmd@AutoCmd
@Cmd(name="simple_pjsua_imported", help="", man="")
module simple_pjsua_imported {
option boolean use_extern_mem = false
source "simple_pjsua_imported.c"
@NoRuntime depends third_party.pjproject.libpj_all
include project.pjsip.cmd.simple_pjsua_imported

Launch PJSIP on STM32F769I-Discovery

  • A file with compiler flags (build.conf)
  • A linker file, where memory segments are described (lds.conf).
  • A file with modules list or a system description (mods.conf)
  • The ‘’ file. The SIP account specification
include embox.kernel.thread.core(thread_pool_size=5,thread_stack_size=12000)
include embox.mem.heap_bm
include embox.mem.static_heap(heap_size=0x3C000)

Finding out the heap size

$ valgrind --tool=massif --time-unit=B --massif-out-file=pjsip.massif ./pjsip-apps/bin/samples/x86_64-unknown-linux-gnu/simple_pjsua
$ massif-visualizer pjsip.massif
@Runlevel(0) include embox.arch.arm.armmlib.exception_entry(irq_stack_size=1024)

Adding GUI

Design GUI on Linux

Launch on the target board (STM32)

@Cmd(name="sip_nuklear", help="", man="")
module sip_nuklear {
source "icons/phone-accept-80.png",
source "main.c"
source "nuklear_main.c"
source "pjsua.c"
@NoRuntime depends third_party.pjproject.libpj_all
@NoRuntime depends third_party.lib.nuklear
depends embox.driver.input.core
depends rawfb_api

Specifics of launch on the board

@Runlevel(1) include
fb_base=0x60000000, width=800, height=480, ltdc_irq=88, bpp=32
include embox.mem.fixed_heap(heap_size=0x200000, heap_start=0x60200000)
@Runlevel(2) include embox.driver.input.touchscreen.stm32f7cube_ts
@Runlevel(2) include embox.driver.input.input_dev_devfs
@Runlevel(0) include embox.arch.arm.armmlib.armv7m_cpu_cache( log_level=4,sram_nocache_section_size=0x10000)

Development process



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store