Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem compiling an example (Basic_Serial) on Linux (x86_64) #139

Open
K4rolis opened this issue Sep 4, 2016 · 6 comments
Open

Problem compiling an example (Basic_Serial) on Linux (x86_64) #139

K4rolis opened this issue Sep 4, 2016 · 6 comments
Labels

Comments

@K4rolis
Copy link

K4rolis commented Sep 4, 2016

Hi,

Before reading further, please keep in mind that I'm really new at this.

What is the correct procedure (starting from scratch) to compile a sample application? Let's say I'm interested in the Basic_Serial.

Steps that I have followed:

  • Clone the esp-open-sdk:
    git clone --recursive https://github.com/pfalcon/esp-open-sdk.git
  • Build the esp-open-sdk as non-standalone (after changing the Makefile to fetch the 1.3.0 version, however, I do believe that this is irrelevant since esp-open-sdk build process appears to fetch the NONOS SDK anyway):
    make STANDALONE=n
  • Clone the Espressif RTOS SDK (I'm quite sure that this is where things went wrong, since I'm not sure whether this actually clones the RTOS 1.3.0 which is mentioned in the readme for this repo):
    git clone https://github.com/espressif/ESP8266_RTOS_SDK.git --branch 1.3.x --single-branch
  • Clone the SmingRTOS:
    git clone https://github.com/SmingHub/SmingRTOS.git
  • Set up some environment variables:
export ESP_HOME="/home/kom/esp/esp-open-sdk/"
export SDK_BASE="/home/kom/esp/ESP8266_RTOS_SDK/"
export SMING_HOME="/home/kom/esp/SmingRTOS/sming/"
  • Build the libsming:
    cd $SMING_HOME && make
    Problem 1: JsonVariant.cpp is referring to errno.h that no longer exists, uncommenting line 13 and commenting line 12 seems to fix it
  • Build the example:
    cd $SMING_HOME/../samples/Basic_Serial/ && make:
C+ app/application.cpp
AR out/build/app_app.a
LD out/build/app.out
/home/kom/esp/ESP8266_RTOS_SDK//lib/libmain.a(app_main.o): In function `user_init_task':
(.irom0.text+0x580): undefined reference to `user_rf_cal_sector_set'
/home/kom/esp/ESP8266_RTOS_SDK//lib/libmain.a(app_main.o): In function `flash_data_check':
(.irom0.text+0x655): undefined reference to `user_rf_cal_sector_set'
collect2: error: ld returned 1 exit status
/home/kom/esp/SmingRTOS/sming//Makefile-project.mk:287: recipe for target 'out/build/app.out' failed
make: *** [out/build/app.out] Error 1

What did I miss? Am I using incorrect RTOS SDK version? Adding code from here to user_main.cpp seems to fix the build issue, is this the correct way of solving this? If so, why hasn't this been submitted to the repo?

My apologies if the formatting is less-than-ideal - this is my first message on GitHub ever!

Karolis

@zhivko
Copy link

zhivko commented Sep 4, 2016

Today I tried compiling Basic_rBoot sample and I also get this error:

~/git/SmingRtosOff/samples/Basic_rBoot$ make rebuild
OC out/build/libmain2.a
make -C /home/klemen/git/SmingRtosOff/sming/rboot
make[1]: Entering directory '/home/klemen/git/SmingRtosOff/sming/rboot'
CC rboot-stage2a.c
LD /home/klemen/git/SmingRtosOff/samples/Basic_rBoot/out/build/rboot-stage2a.elf
E2 /home/klemen/git/SmingRtosOff/samples/Basic_rBoot/out/build/rboot-hex2a.h
CC rboot.c
LD /home/klemen/git/SmingRtosOff/samples/Basic_rBoot/out/build/rboot.elf
E2 /home/klemen/git/SmingRtosOff/samples/Basic_rBoot/out/firmware/rboot.bin
make[1]: Leaving directory '/home/klemen/git/SmingRtosOff/sming/rboot'
C+ app/application.cpp
CC /home/klemen/git/SmingRtosOff/sming/rboot/appcode/rboot-bigflash.c
CC /home/klemen/git/SmingRtosOff/sming/rboot/appcode/rboot-api.c
AR out/build/app_app.a
LD out/build/app_0.out
out/build/libmain2.a(app_main.o): In function `user_init_task':
(.irom0.text+0x580): undefined reference to `user_rf_cal_sector_set'
out/build/libmain2.a(app_main.o): In function `flash_data_check':
(.irom0.text+0x655): undefined reference to `user_rf_cal_sector_set'
collect2: error: ld returned 1 exit status
/home/klemen/git/SmingRtosOff/sming/Makefile-rboot.mk:334: recipe for target 'out/build/app_0.out' failed
make: *** [out/build/app_0.out] Error 1

This is very strange sinc eI know I compiled this succesfully before.

@zhivko
Copy link

zhivko commented Sep 4, 2016

For me I needed to change main.cpp to this:

#include "espressif/esp_common.h"

#include "sming/include/sming_config.h"

//#include "sming/include/SmingCore.h"

extern void init();

extern "C" void  __attribute__((weak)) user_init(void)
{
    printf("Sming RTOS Proof of Concept \r\n");
    printf("SDK version:%s\n", system_get_sdk_version());
    printf("FreeHeapSize = %d\r\n",xPortGetFreeHeapSize());
    init();
}

extern "C" uint32 ICACHE_FLASH_ATTR
user_rf_cal_sector_set(void)
{
    //enum
    flash_size_map size_map = system_get_flash_size_map();
    uint32 rf_cal_sec = 0;

    switch (size_map) {
        case FLASH_SIZE_4M_MAP_256_256:
            rf_cal_sec = 128 - 5;
            break;

        case FLASH_SIZE_8M_MAP_512_512:
            rf_cal_sec = 256 - 5;
            break;

        case FLASH_SIZE_16M_MAP_512_512:
        case FLASH_SIZE_16M_MAP_1024_1024:
            rf_cal_sec = 512 - 5;
            break;

        case FLASH_SIZE_32M_MAP_512_512:
        case FLASH_SIZE_32M_MAP_1024_1024:
            rf_cal_sec = 1024 - 5;
            break;

        default:
            rf_cal_sec = 0;
            break;
    }

    return rf_cal_sec;
}


// For compatibility with SDK v1.1
extern "C" void __attribute__((weak)) user_rf_pre_init(void)
{
    // RTC startup fix, author pvvx
    volatile uint32 * ptr_reg_rtc_ram = (volatile uint32 *)0x60001000;
    if((ptr_reg_rtc_ram[24] >> 16) > 4) {
        ptr_reg_rtc_ram[24] &= 0xFFFF;
        ptr_reg_rtc_ram[30] &= 0;
    }
}

notice: extern "C" uint32 ICACHE_FLASH_ATTR
instead of uint32 ICACHE_FLASH_ATTR
as it is mentioned in @K4rolis post above.

@hreintke
Copy link
Collaborator

hreintke commented Sep 5, 2016

@zhivko :
If you create a PR I will merge

@K4rolis
Copy link
Author

K4rolis commented Sep 5, 2016

@hreintke what about the errno.h thing? Or am I doing something wrong? And also, was the method I used the correct method to fetch the required RTOS SDK?

@zhivko
Copy link

zhivko commented Sep 5, 2016

@hreintke ok will do that, but how Basic_rBoot sample works for you with upper error - sorry maybe missing a point here.

@zhivko
Copy link

zhivko commented Sep 5, 2016

@hreintke it will be hard for me to create pull request since my SmingRTOS includes some additional features.
But here is diff.

user_rf_cal_sector_set.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants