Warning pe012 parsing restarts here after previous syntax error

IAR ARM compilation errors #437 Comments disgusting code style. Error[Pe144]: a value of type «void const *» cannot be used to initialize an entity of type «uint8_t const lfs_util.c 22 Error[Pe144]: a value of type «void *» cannot be used to initialize an entity of type «lfs_testbd *» bdlfs_testbd.c 30 Error[Pe513]: a value of […]

IAR ARM compilation errors #437

Comments

disgusting code style.

Error[Pe144]: a value of type «void const *» cannot be used to initialize an entity of type «uint8_t const lfs_util.c 22

Error[Pe144]: a value of type «void *» cannot be used to initialize an entity of type «lfs_testbd *» bdlfs_testbd.c 30
Error[Pe513]: a value of type «void *» cannot be assigned to an entity of type «uint32_t *» bdlfs_testbd.c 39
Error[Pe513]: a value of type «void *» cannot be assigned to an entity of type «uint32_t *» bdlfs_testbd.c 41
Error[Pe029]: expected an expression bdlfs_testbd.c 53
Error[Pe029]: expected an expression bdlfs_testbd.c 60
Warning[Pe012]: parsing restarts here after previous syntax error bdlfs_testbd.c 63
Error[Pe144]: a value of type «void *» cannot be used to initialize an entity of type «lfs_testbd *» bdlfs_testbd.c 89
Error[Pe144]: a value of type «void *» cannot be used to initialize an entity of type «lfs_testbd *» bdlfs_testbd.c 108
Error[Pe144]: a value of type «void *» cannot be used to initialize an entity of type «lfs_testbd *» bdlfs_testbd.c 118
Error[Pe144]: a value of type «void *» cannot be used to initialize an entity of type «lfs_testbd *» bdlfs_testbd.c 128
Error[Pe144]: a value of type «void *» cannot be used to initialize an entity of type «lfs_testbd *» bdlfs_testbd.c 137
Error[Pe144]: a value of type «void *» cannot be used to initialize an entity of type «lfs_testbd *» bdlfs_testbd.c 151
Error[Pe020]: identifier «assert» is undefined bdlfs_testbd.c 154
Error[Pe144]: a value of type «void *» cannot be used to initialize an entity of type «lfs_testbd *» bdlfs_testbd.c 176
Error[Pe020]: identifier «assert» is undefined bdlfs_testbd.c 179
Error[Pe144]: a value of type «void *» cannot be used to initialize an entity of type «lfs_testbd *» bdlfs_testbd.c 222
Error[Pe020]: identifier «assert» is undefined bdlfs_testbd.c 225
Error[Pe144]: a value of type «void *» cannot be used to initialize an entity of type «lfs_testbd *» bdlfs_testbd.c 279
Error[Pe020]: identifier «assert» is undefined bdlfs_testbd.c 282
Error[Pe144]: a value of type «void *» cannot be used to initialize an entity of type «lfs_testbd *» bdlfs_testbd.c 292
Error[Pe020]: identifier «assert» is undefined bdlfs_testbd.c 295
Error while running C/C++ Compiler
lfs_filebd.c
Warning[Pa050]: non-native end of line sequence detected (this diagnostic is only issued once) bdlfs_filebd.h 1
Error[Pe144]: a value of type «void *» cannot be used to initialize an entity of type «lfs_filebd *» bdlfs_filebd.c 26
Error[Pe020]: identifier «O_RDWR» is undefined bdlfs_filebd.c 30
Error[Pe020]: identifier «O_CREAT» is undefined bdlfs_filebd.c 30
Error[Pe020]: identifier «open» is undefined bdlfs_filebd.c 30
Error[Pe144]: a value of type «void *» cannot be used to initialize an entity of type «lfs_filebd *» bdlfs_filebd.c 60
Error[Pe020]: identifier «close» is undefined bdlfs_filebd.c 61
Error[Pe144]: a value of type «void *» cannot be used to initialize an entity of type «lfs_filebd *» bdlfs_filebd.c 76
Error[Pe020]: identifier «assert» is undefined bdlfs_filebd.c 79
Error[Pe020]: identifier «off_t» is undefined bdlfs_filebd.c 89
Error[Pe020]: identifier «off_t» is undefined bdlfs_filebd.c 90
Error[Pe018]: expected a «)» bdlfs_filebd.c 90
Error[Pe020]: identifier «lseek» is undefined bdlfs_filebd.c 89
Error[Pe040]: expected an identifier bdlfs_filebd.c 90
Error[Pe020]: identifier «ssize_t» is undefined bdlfs_filebd.c 97
Error[Pe020]: identifier «read» is undefined bdlfs_filebd.c 97
Error[Pe144]: a value of type «void *» cannot be used to initialize an entity of type «lfs_filebd *» bdlfs_filebd.c 112
Error[Pe020]: identifier «assert» is undefined bdlfs_filebd.c 115
Error[Pe020]: identifier «off_t» is undefined bdlfs_filebd.c 121
Error[Pe020]: identifier «off_t» is undefined bdlfs_filebd.c 122
Error[Pe018]: expected a «)» bdlfs_filebd.c 122
Error[Pe020]: identifier «lseek» is undefined bdlfs_filebd.c 121
Error[Pe040]: expected an identifier bdlfs_filebd.c 122
Error[Pe020]: identifier «ssize_t» is undefined bdlfs_filebd.c 131
Error[Pe020]: identifier «read» is undefined bdlfs_filebd.c 131
Error[Pe020]: identifier «off_t» is undefined bdlfs_filebd.c 143
Error[Pe020]: identifier «off_t» is undefined bdlfs_filebd.c 144
Error[Pe018]: expected a «)» bdlfs_filebd.c 144
Error[Pe020]: identifier «lseek» is undefined bdlfs_filebd.c 143
Error[Pe040]: expected an identifier bdlfs_filebd.c 144
Error[Pe020]: identifier «ssize_t» is undefined bdlfs_filebd.c 151
Error[Pe020]: identifier «write» is undefined bdlfs_filebd.c 151
Error[Pe144]: a value of type «void *» cannot be used to initialize an entity of type «lfs_filebd *» bdlfs_filebd.c 164
Error[Pe020]: identifier «assert» is undefined bdlfs_filebd.c 167
Error[Pe020]: identifier «off_t» is undefined bdlfs_filebd.c 171
Error[Pe020]: identifier «off_t» is undefined bdlfs_filebd.c 171
Error[Pe018]: expected a «)» bdlfs_filebd.c 171
Error[Pe020]: identifier «lseek» is undefined bdlfs_filebd.c 171
Error[Pe040]: expected an identifier bdlfs_filebd.c 171
Error[Pe020]: identifier «ssize_t» is undefined bdlfs_filebd.c 179
Error[Pe029]: expected an expression bdlfs_filebd.c 179
Error[Pe020]: identifier «write» is undefined bdlfs_filebd.c 179
Error[Pe144]: a value of type «void *» cannot be used to initialize an entity of type «lfs_filebd *» bdlfs_filebd.c 195
Error[Pe020]: identifier «fsync» is undefined bdlfs_filebd.c 196
Error while running C/C++ Compiler
lfs.c
Warning[Pa050]: non-native end of line sequence detected (this diagnostic is only issued once) lfs.c 1
Error[Pe144]: a value of type «void *» cannot be used to initialize an entity of type «uint8_t *» lfs.c 31
Error[Pe020]: identifier «assert» is undefined lfs.c 90
Error[Pe144]: a value of type «void const *» cannot be used to initialize an entity of type «uint8_t const *» lfs.c 120
Error[Pe020]: identifier «assert» is undefined lfs.c 142
Error[Pe020]: identifier «assert» is undefined lfs.c 182
Error[Pe144]: a value of type «void const *» cannot be used to initialize an entity of type «uint8_t const *» lfs.c 190
Error[Pe020]: identifier «assert» is undefined lfs.c 191
Error[Pe020]: identifier «assert» is undefined lfs.c 233
Error[Pe393]: pointer to incomplete class type is not allowed lfs.c 387
Error[Pe393]: pointer to incomplete class type is not allowed lfs.c 387
Error[Pe393]: pointer to incomplete class type is not allowed lfs.c 388
Error[Pe393]: pointer to incomplete class type is not allowed lfs.c 388
Error[Pe393]: pointer to incomplete class type is not allowed lfs.c 392
Error[Pe393]: pointer to incomplete class type is not allowed lfs.c 392
Error[Pe393]: pointer to incomplete class type is not allowed lfs.c 393
Error[Pe393]: pointer to incomplete class type is not allowed lfs.c 393
Warning[Pe224]: the format string requires additional arguments lfs.c 495
Error[Pe018]: expected a «)» lfs.c 494
Error[Pe144]: a value of type «void *» cannot be used to initialize an entity of type «uint8_t *» lfs.c 588
Error[Pe144]: a value of type «void *» cannot be used to initialize an entity of type «uint32_t *» lfs.c 647
Error[Pe167]: argument of type «void const *» is incompatible with parameter of type «lfs_mdir const *» lfs.c 741
Error[Pe144]: a value of type «void const *» cannot be used to initialize an entity of type «lfs_attr const *» lfs.c 751
Error[Pe029]: expected an expression lfs.c 940
Warning[Pe224]: the format string requires additional arguments lfs.c 998
Error[Pe018]: expected a «)» lfs.c 997
Error[Pe070]: incomplete type is not allowed lfs.c 1045
Error[Pe144]: a value of type «void *» cannot be used to initialize an entity of type «lfs_dir_find_match *» lfs.c 1070
Error[Pe144]: a value of type «void const *» cannot be used to initialize an entity of type «lfs_diskoff const *» lfs.c 1072
Error[Pe029]: expected an expression lfs.c 1172
Error[Pe144]: a value of type «void const *» cannot be used to initialize an entity of type «lfs_diskoff const *» lfs.c 1241
Error[Pe2363]: cast to incomplete array type «lfs_mattr []» is not allowed lfs.c 1403
Error[Pe029]: expected an expression lfs.c 1403
Error[Pe2363]: cast to incomplete array type «lfs_mattr []» is not allowed lfs.c 1403
Error[Pe029]: expected an expression lfs.c 1403
Error[Pe144]: a value of type «void *» cannot be used to initialize an entity of type «uint32_t *» lfs.c 1447
Error[Pe144]: a value of type «void *» cannot be used to initialize an entity of type «lfs_dir_commit_commit *» lfs.c 1460
Error[Pe119]: cast to type «unsigned int const [2]» is not allowed lfs.c 1525
Error[Pe029]: expected an expression lfs.c 1525
Warning[Pe224]: the format string requires additional arguments lfs.c 1536
Error[Pe018]: expected a «)» lfs.c 1536
Error[Pe029]: expected an expression lfs.c 1606
Error[Pe020]: identifier «assert» is undefined lfs.c 1667
Error[Pe029]: expected an expression lfs.c 1673
Warning[Pe224]: the format string requires additional arguments lfs.c 1685
Error[Pe018]: expected a «)» lfs.c 1685
Error[Pe119]: cast to type «unsigned int const [2]» is not allowed lfs.c 1689
Error[Pe029]: expected an expression lfs.c 1689
Warning[Pe224]: the format string requires additional arguments lfs.c 1691
Error[Pe018]: expected a «)» lfs.c 1690
Warning[Pe224]: the format string requires additional arguments lfs.c 1709
Error[Pe018]: expected a «)» lfs.c 1707
Error[Pe020]: identifier «assert» is undefined lfs.c 1746
Error[Pe029]: expected an expression lfs.c 1792
Error[Pe020]: identifier «assert» is undefined lfs.c 1840
Error[Pe029]: expected an expression lfs.c 1845
Error[Pe144]: a value of type «lfs::lfs_mlist *» cannot be used to initialize an entity of type «lfs_mlist *» lfs.c 1866
Error[Pe393]: pointer to incomplete class type is not allowed lfs.c 1866
Error[Pe393]: pointer to incomplete class type is not allowed lfs.c 1867
Error[Pe393]: pointer to incomplete class type is not allowed lfs.c 1867
Error[Pe393]: pointer to incomplete class type is not allowed lfs.c 1868
Error[Pe393]: pointer to incomplete class type is not allowed lfs.c 1871
Error[Pe393]: pointer to incomplete class type is not allowed lfs.c 1872
Error[Pe393]: pointer to incomplete class type is not allowed lfs.c 1873
Error[Pe393]: pointer to incomplete class type is not allowed lfs.c 1875
Error[Pe393]: pointer to incomplete class type is not allowed lfs.c 1876
Error[Pe393]: pointer to incomplete class type is not allowed lfs.c 1877
Error[Pe393]: pointer to incomplete class type is not allowed lfs.c 1881
Error[Pe393]: pointer to incomplete class type is not allowed lfs.c 1882
Error[Pe393]: pointer to incomplete class type is not allowed lfs.c 1883
Error[Pe144]: a value of type «lfs::lfs_mlist *» cannot be used to initialize an entity of type «lfs_mlist *» lfs.c 1891
Error[Pe393]: pointer to incomplete class type is not allowed lfs.c 1891
Error[Pe393]: pointer to incomplete class type is not allowed lfs.c 1892
Error[Pe393]: pointer to incomplete class type is not allowed lfs.c 1893
Error[Pe393]: pointer to incomplete class type is not allowed lfs.c 1893
Error[Pe393]: pointer to incomplete class type is not allowed lfs.c 1893
Error[Pe393]: pointer to incomplete class type is not allowed lfs.c 1895
Error[Pe393]: pointer to incomplete class type is not allowed lfs.c 1895
Error[Pe393]: pointer to incomplete class type is not allowed lfs.c 1896
Error[Pe393]: pointer to incomplete class type is not allowed lfs.c 1896
Error[Pe070]: incomplete type is not allowed lfs.c 1918
Error[Pe2363]: cast to incomplete array type «lfs_mattr []» is not allowed lfs.c 1955
Error[Pe029]: expected an expression lfs.c 1955
Error[Pe2363]: cast to incomplete array type «lfs_mattr []» is not allowed lfs.c 1955
Error[Pe029]: expected an expression lfs.c 1955
Error[Pe2363]: cast to incomplete array type «lfs_mattr []» is not allowed lfs.c 1977
Error[Pe029]: expected an expression lfs.c 1977
Error[Pe2363]: cast to incomplete array type «lfs_mattr []» is not allowed lfs.c 1977
Error[Pe029]: expected an expression lfs.c 1977
Error[Pe2363]: cast to incomplete array type «lfs_mattr []» is not allowed lfs.c 1992
Error[Pe029]: expected an expression lfs.c 1992
Error[Pe2363]: cast to incomplete array type «lfs_mattr []» is not allowed lfs.c 1992
Error[Pe029]: expected an expression lfs.c 1992
Error[Pe513]: a value of type «lfs_mlist *» cannot be assigned to an entity of type «lfs::lfs_mlist *» lfs.c 2053
Error[Pe144]: a value of type «lfs::lfs_mlist **» cannot be used to initialize an entity of type «lfs_mlist **» lfs.c 2062
Error[Pe393]: pointer to incomplete class type is not allowed lfs.c 2062
Error[Pe393]: pointer to incomplete class type is not allowed lfs.c 2064
Error[Pe029]: expected an expression lfs.c 2216
Warning[Pe224]: the format string requires additional arguments lfs.c 2331
Error[Pe018]: expected a «)» lfs.c 2331
Error[Pe029]: expected an expression lfs.c 2346
Error[Pe513]: a value of type «lfs_mlist *» cannot be assigned to an entity of type «lfs::lfs_mlist *» lfs.c 2418
Error[Pe2363]: cast to incomplete array type «lfs_mattr []» is not allowed lfs.c 2434
Error[Pe029]: expected an expression lfs.c 2434
Error[Pe2363]: cast to incomplete array type «lfs_mattr []» is not allowed lfs.c 2434
Error[Pe029]: expected an expression lfs.c 2434
Error[Pe167]: argument of type «lfs_file::lfs_ctz *» is incompatible with parameter of type «lfs_ctz *» lfs.c 2462
Error[Pe513]: a value of type «void *» cannot be assigned to an entity of type «uint8_t *» lfs.c 2491
Error limit reached
Error while running C/C++ Compiler

The text was updated successfully, but these errors were encountered:

I’m not really sure how to respond to this. Looking through a few of the warnings and the existing code is perfectly valid c99 code.

If change the compilation mode, then the rest of the project wrong building. The principle «Either this or that».

I almost rework littlefs for C ++ without using macros. Macros are real Evil.
But unfortunately I could not correctly replace macros:

with inline functions. If you can help me with this, then littlefs will build correctly in all cases.

For example like here:

Ah, unfortunately C++ is no longer a superset of C. As they bother developed they have diverged. I don’t know the history there, but the version of C compatible with C++ (C89 I think?) lacks a lot of usability features (variables must be initialized at start of block, static, const, no C++ comments (//)), so I believe C99 is the best C standard to adopt at this time.

To combine C++/littlefs I would use two different compilation modes:
gcc -std=c99 lfs.c -o lfs.o
g++ -std=c++11 main.cpp -o main.o
g++ lfs.o main.o -o app.elf

If change the compilation mode, then the rest of the project wrong building. The principle «Either this or that».

That sounds like an IDE/build system limitation. What IDE/build system are you using? Can it not handle .c and .cpp files differently?

I almost rework littlefs for C ++ without using macros. Macros are real Evil.
But unfortunately I could not correctly replace macros:

LFS_MKATTRS creates an array on the stack which is used to pass a LISP-like list of commands to lfs_dir_commit. This is one case where an inline function won’t work as it needs a variable number of arguments.

Источник

Решил я тут разобраться с тем, как ИАР реализовал свои функции работы с EEPROM, потому что раньше применял свои функции, а теперь решил применить ИАРовские. Почитал документы, поизучал исходники, посмотрел конференцию. Нашел сообщения и файл коллеги IgorKossak который он всем рекомендует. И как-то из последних сообщений выходит, что у ИАРа библиотеки неправильные.

Решил я поэтому опубликовать свои выводы, поскольку получается, что библиотеки то правильные (здесь я не говорю об их ошибке с записью long long — ошибка она и есть ошибка), просто границы применимости у них различные.

Возмем, к примеру, чтение и запись char в eeprom, размером более 256 байт.

Оригинальная библиотека ИАР АВР 4.21А (если убрать все лишние переходы):

?eewait:
        SBIC    EECR,EEWE
        RJMP    ?eewait
        RET

__eeget8_16:
        RCALL   ?eewait
        OUT     EEARL,r20
        OUT     EEARH,r21
        SBI     EECR,EERE
        IN      r16,EEDR
        RET

__eeput8_16:
        IN      r0,SREG
        RCALL   ?eewait
        OUT     EEDR,r16
        OUT     EEARL,r20
        OUT     EEARH,r21
        CLI
        SBI     EECR,EEMWE
        SBI     EECR,EEWE
        OUT     SREG,r0
        RET

Анализируя этот код можно определить область применимости этих процедур:

Эти функции можно применять (без дополнительного запрещения прерываний) только в одном потоке, т.е. или в main или в прерываниях одного уровня. Применение даже только чтения и в основном цикле и в прерывании периодически будет приводить к краху чтения. Дополнительное ограничение — функцию записи нельзя применять при наличии самопрограммирования флеша (команд SPM) в другом потоке.

Возмем теперь исправленный вариант от IgorKossak. Исправления следующие:

описание (исправлений) можно свести к двум пунктам:

1) любая критическая работа с ЕЕПРОМ (за исключением кристаллов AT86RF401), требующая непрерываемости, обрамлена в обёртку типа:

сохранить SREG

CLI

критическая работа с ЕЕПРОМ

восстановить SREG

2) исправлена ошибка в подпрограмме записи в ЕЕПРОМ 64-битных чисел.

?eewait:
        CLI
        SBIS    EECR,EEWE
        RET
        OUT     SREG,r0
        RJMP    ?eewait

__eeget8_16:
        PUSH    r0
        IN      r0,SREG
        RCALL   ?eewait
        OUT     EEARL,r20
        OUT     EEARH,r21
        SBI     EECR,EERE
        IN      r16,EEDR
        OUT     SREG,r0
        POP     r0
        RET

__eeput8_16:
        IN      r0,SREG
        RCALL   ?eewait
        OUT     EEDR,r16
        OUT     EEARL,r20
        OUT     EEARH,r21
        SBI     EECR,EEMWE
        SBI     EECR,EEWE
        OUT     SREG,r0
        RET

Запрещение прерываний на все время работы функций вместе и изящным решением «прозрачного» для прерываний ожидания готовности. Расширение границ применяемости налицо. Теперь работу с EEPROM можно производить в нескольких параллельных потоках. То, что при этом может происходить «замирание» обработки прерывания на время ожидания готовности — дело программиста: применять или нет.

Теперь любой, кому придет в голову эта бредовая идея, может писать EEPROM в прерываниях без фатальных последствий для своей программы :)

А вот проверки готовности флеша (от SPM) тут тоже нет. И это нужно помнить.

Так что применять можно все, только нужно хорошо понимать что делаешь :)

з.ы. меня сначала смутил тот момент, что сохранение регистра r0, IgorKossak добавил только в __eeget8_16 :07:

Но при проверке оказалось, что компилятор не проверяет asm файл с текстом неоригинальной программы, а тупо смотрит на имя функции. Если в прерывании есть __eeput8_16, то сохраняет r0, хотя вы его в своей функции можете и не применять, а применять кучу других регистров, которые компилятор и не подумает сохранить. А если видит __eeget8_16, то r0 не сохраняет (в оригинальной функции его нет).

#c #git #msp430 #prng

#c #git #msp430 #prng

Вопрос:

В настоящее время я пытаюсь создать генератор случайных чисел, используя MSP430 (MSP43 G2553), а затем создать алгоритм для генератора псевдослучайных чисел. У меня есть код для этих двух процессов, а также код, используемый для тестирования программ со светодиодами. По какой-то причине я сталкиваюсь с некоторыми ошибками, которые, похоже, не могу устранить. Я приложу коды и ошибки, чтобы получить второе мнение о синтаксисе.

  #include <msp430g2553.h>

 #include "rand.h"

    /**
     * Random number generator.
     *
     * NOTE: This affects Timer A.
     *
     * Algorithm from TI SLAA338:
     * http://www.ti.com/sc/docs/psheets/abstract/apps/slaa338.htm
     *
     * @return 16 random bits generated from a hardware source.
     */





        unsigned int rand(); {
        int i, j;
        unsigned int result = 0;

        /* Save state */
        unsigned int TACCTL0_old = TACCTL0;
        unsigned int TACTL_old = TACTL;

        /* Set up timer */
        TACCTL0 = CAP | CM_1 | CCIS_1;            // Capture mode, positive edge
        TACTL = TASSEL_2 | MC_2;                  // SMCLK, continuous up

        /* Generate bits */
        for (i = 0; i < 16; i  ) {
            unsigned int ones = 0;

            for (j = 0; j < 5; j  ) {
                while (!(CCIFG amp; TACCTL0));       // Wait for interrupt

                TACCTL0 amp;= ~CCIFG;                // Clear interrupt

                if (1 amp; TACCR0)                   // If LSb set, count it
                    ones  ;
            }

            result >>= 1;                         // Save previous bits

            if (ones >= 3)                        // Best out of 5
                result |= 0x8000;                 // Set MSb
        }

        /* Restore state */


        TACCTL0 = TACCTL0_old;
            TACTL = TACTL_old;

            return resu<
        }



    /**
     * Pseudo-random number generator.
     *
     * Implemented by a 16-bit linear congruential generator.
     * NOTE: Only treat the MSB of the return value as random.
     *
     * @param state Previous state of the generator.
     * @return Next state of the generator.
     */

        unsigned int prand(unsigned int state) {
            return (M * state   I);                   // Generate the next state of the LCG
        }
 

Это код для RNG и PRNG. Список ошибок:

 Warning[Pa050]: non-native end of line sequence detected (this diagnostic is only issued once) E:Downloadsmsp430-rng-masterrand.h 1 
Error[Pe169]: expected a declaration E:Downloadsmsp430-rng-masterrand.c 18 
Error[Pe169]: expected a declaration E:Downloadsmsp430-rng-masterrand.c 39 
Error[Pe169]: expected a declaration E:Downloadsmsp430-rng-masterrand.c 41 
Error[Pe169]: expected a declaration E:Downloadsmsp430-rng-masterrand.c 45 
Error[Pe169]: expected a declaration E:Downloadsmsp430-rng-masterrand.c 47 
Warning[Pe012]: parsing restarts here after previous syntax error E:Downloadsmsp430-rng-masterrand.c 50 
Error[Pe077]: this declaration has no storage class or type specifier E:Downloadsmsp430-rng-masterrand.c 51 
Error[Pe147]: declaration is incompatible with "unsigned short volatile TA0CTL @ 0x160" (declared at line 527 of "C:Program Files (x86)IAR SystemsEmbedded  E:Downloadsmsp430-rng-masterrand.c 51 
Workbench 6.5430incmsp430g2553.h") 
Error[Be022]: location address not allowed for initialized variables (writable variables without the __no_init attribute) E:Downloadsmsp430-rng-masterrand.c 51 
Error[Pe020]: identifier "TACTL_old" is undefined E:Downloadsmsp430-rng-masterrand.c 51 
Error[Pe169]: expected a declaration E:Downloadsmsp430-rng-masterrand.c 53 
Error[Pe169]: expected a declaration E:Downloadsmsp430-rng-masterrand.c 54 
Warning[Pe012]: parsing restarts here after previous syntax error E:Downloadsmsp430-rng-masterrand.c 68 
 

Код для тестирования выглядит следующим образом:

  #include <msp430g2553.h>
    #include <signal.h>
    #include <isr_compat.h>

    #include "rand.h"

    #define LED_OUT P1OUT
    #define LED_DIR P1DIR

    #define LED_RED   BIT0
    #define LED_GREEN BIT6

    #define BLINK_DELAY 1200                      // 200 ms at 6 KHz

    #define BITS_RAND  16
    #define BITS_PRAND 8                          // Using only the MSB of the prand state

    int failure = 0;

    /**
     * Set up the timers and blink!
     */
    void prepare_to_blink() {
        BCSCTL3 |= LFXT1S_2;                      // Set LF to VLO = 12 KHz
        BCSCTL1 |= DIVA_1;                        // ACLK = LF / 2 = 6 KHz

        TACCR0 = BLINK_DELAY;                     // Set the timer
        TACTL = TASSEL_1 | MC_1;                  // TACLK = ACLK; up to CCR0
        TACCTL1 = CCIE | OUTMOD_3;                // TA1 interrupt enable; PWM set/reset

        __bis_SR_register(LPM3_bits | GIE);       // LPM3 w/ interrupt
    }

    int interrupt(TIMERA1_VECTOR) blink_LED (void) {
        TACCTL1 amp;= ~CCIFG;                        // Unset interrupt flag

        if (failure)                              // Toggle LEDs
            LED_OUT ^= LED_RED;
        else
            LED_OUT ^= LED_GREEN;
    }

    /******************************************************************************
     * Monobit
     *
     * SP 800-22 Rev. 1a
     * http://csrc.nist.gov/publications/nistpubs/800-22-rev1a/SP800-22rev1a.pdf
     ******************************************************************************/

    /* The hardware RNG is slow, so limit test to 400 bits. */
    #define MONOBIT_TIMES_RAND 25                 // 400 / BITS_RAND

    /* Each 8-bit number tested with monobit contributes 8 bits, so in the worst
     * case, the signed 16-bit bucket can store information about this many
     * numbers: */
    #define MONOBIT_TIMES_PRAND 4095              // (2 ^ 15 - 1) / BITS_PRAND

    /* The maximum absolute value of the sum bucket after a monobit test, where
     * 0.01 is the minimum P-value and inverfc is the inverse of the complementary
     * error function. */
    #define MONOBIT_MAX_VAL_RAND  51              // inverfc(0.01) * sqrt(2) * sqrt(400)
    #define MONOBIT_MAX_VAL_PRAND 466             // inverfc(0.01) * sqrt(2) * sqrt(2 ^ 15 - 1)

    /**
     * Monobit test for rand().
     *
     * Returns 0 on success; otherwise otherwise.
     */
    int monobit_rand() {
        int sum = 0;

        int i, j;

        for (i = 0; i < MONOBIT_TIMES_RAND; i  ) {
            int r = rand();

            /* Add up all the bits, taking 0 to mean -1. */
            for (j = 0; j < BITS_RAND; j  ) {
                sum  = r amp; 0x1 ? 1 : -1;
                r >>= 1;
            }
        }

        if (sum < 0)
            sum = 0 - sum;                        // Absolute value

        return sum > MONOBIT_MAX_VAL_RAND;
    }

    /**
     * Monobit test for prand().
     *
     * Returns 0 on success; otherwise otherwise.
     */
    int monobit_prand() {
        int state = rand();
        int sum = 0;

        int i, j;

        for (i = 0; i < MONOBIT_TIMES_PRAND; i  ) {
            int r = state >> (16 - BITS_PRAND);   // Ignore the least significant bits

            /* Add up all the bits, taking 0 to mean -1. */
            for (j = 0; j < BITS_PRAND; j  ) {
                sum  = r amp; 0x1 ? 1 : -1;
                r >>= 1;
            }

            state = prand(state);
        }

        if (sum < 0)
            sum = 0 - sum;                        // Absolute value

        return sum > MONOBIT_MAX_VAL_PRAND;
    }

    /**
     * Store the failure code on the top of the stack and alternate flashing the
     * LEDs to signify failure.
     *
     * Never returns!
     */
    void fail(int code) {
        asm("push %0" : : "r" (code));

        failure = 1;

        LED_OUT amp;= ~LED_GREEN;
        prepare_to_blink();
    }

    /**
     * Run though all the tests.
     *
     * Both LEDs are lit up while testing, and one will blink once the tests are
     * done, depending on the outcome.
     */
    void main() {
        LED_DIR |= LED_RED | LED_GREEN;
        LED_OUT |= LED_RED | LED_GREEN;

        if (monobit_rand())
            fail(0xdead);

        if (monobit_prand())
            fail(0xbeef);

        LED_OUT amp;= ~LED_RED;
        prepare_to_blink();
    }
 

И список ошибок при компиляции:

 Warning[Pa050]: non-native end of line sequence detected (this diagnostic is only issued once) E:Downloadsmsp430-rng-masterrand.h 1 

Error[Pe169]: expected a declaration E:Downloadsmsp430-rng-mastertest.c 34 

Warning[Pe012]: parsing restarts here after previous syntax error E:Downloadsmsp430-rng-mastertest.c 116 

Warning[Pe1051]: standard requires that parameter "TIMERA1_VECTOR" be given a type by a subsequent declaration ("int" assumed) E:Downloadsmsp430-rng-mastertest.c 34 

Error[Pe130]: expected a "{" E:Downloadsmsp430-rng-mastertest.c 117 

Warning[Pe940]: missing return statement at end of non-void function "interrupt" E:Downloadsmsp430-rng-mastertest.c 117 

Error[Pe018]: expected a ")" E:Downloadsmsp430-rng-mastertest.c 126 

Warning[Pe223]: function "monobit_rand" declared implicitly E:Downloadsmsp430-rng-mastertest.c 144 

Warning[Pe223]: function "monobit_prand" declared implicitly E:Downloadsmsp430-rng-mastertest.c 147 
 

Ответ №1:

У вас неправильный синтаксис. Пожалуйста, посмотрите следующую строку:

unsigned int rand(); {

Эта строка должна гласить:

unsigned int rand() {

Редактировать

В вашем тестовом коде у вас есть следующее:

int interrupt(TIMERA1_VECTOR) blink_LED (void) {

Я никогда не видел, чтобы процедура обслуживания прерываний определялась таким образом. Вместо этого он должен быть определен (в IAR EW430) следующим образом:

 #pragma vector=TIMERA1_VECTOR
__interrupt void blink_LED(void) {
 

Комментарии:

1. да, это немного прояснило мой журнал ошибок, но у меня все еще есть еще 3, которые меня беспокоят. Ошибка [Pe020]: идентификатор «TIMERA1_VECTOR» не определен E:Downloadsmsp430-rng-mastertest.c 32 Ошибка [Pe661]: ожидаемая целочисленная константа E:Downloadsmsp430-rng-mastertest.c 32 Ошибка [Pe018]: ожидаемый ответ «)» E:Downloadsmsp430-rng-mastertest.c 125

2. Как называется вектор в файле msp430g2553.h?

3. #определить TIMER1_A1_VECTOR

4. Так что используйте это как имя вашего вектора.

5. да, это было оно. еще 1, что я не могу понять. для части void fail(int code) { asm(«push %0» : : «r» (code)); failure = 1; LED_OUT amp;= ~LED_GREEN; prepare_to_blink(); } он говорит, что ожидается «)». Я думаю, что что-то не так в синтаксисе.

Hello All,

Here I am, a hardware guy whose uC exposure has pretty much been C51
and very little firmware. So, I loaded the latest IAR Kickstart, got
the TI USB programmer and soldered together a board with an Olimex
F1232 header on there. The 32kHz oscillator runs and all but here is
where it gets frustrating.

Even flashing an LED on P1.0 using the FET_example work space won't do
it. I mean, this is stuff that was supposed to be a 100% sober
evaluation project. I'd think. But it produces a plethora of error
messages on rebuild, even errors in intrinsic.h. What's wrong?

Regards,

Joerg.




Reply by Micah Stevens February 17, 20052005-02-17

It depends, what are the errors? 


On Thursday 17 February 2005 02:31 pm, Joerg
Schulze-Clewing wrote:
>  Hello All,
>
>  Here I am, a hardware guy whose uC exposure has pretty much been C51
>  and very little firmware. So, I loaded the latest IAR Kickstart, got
>  the TI USB programmer and soldered together a board with an Olimex
>  F1232 header on there. The 32kHz oscillator runs and all but here is
>  where it gets frustrating.
>
>  Even flashing an LED on P1.0 using the FET_example work space won't do
>  it. I mean, this is stuff that was supposed to be a 100% sober
>  evaluation project. I'd think. But it produces a plethora of error
>  messages on rebuild, even errors in intrinsic.h. What's wrong?
>
>  Regards,
>
>  Joerg.
>
>
>
>
>
>  .
>
>
>
>
>
>  .

Reply by Onestone February 17, 20052005-02-17

So what are you seeing? I assume you are in the debug mode of workbench 
and have correctly configured all of the project options, including 
selecting simulation or FET Tool? Are you ssure that the TiUSb is 
compatible with IAR? Does the code download, ie you should see an erase 
message followed by a  programming message when you click on C-Spy. If 
so, you should be in C-Spy. Display the source window if it isn't 
displayed, and open a memory window. try changing memory data  by double 
clicking on any RAM address. If you can do that C-Spy is running at 
leasdt, and talking to the board. If not work it backwards from their. 
Confirm download first. If the code is so small that download passes so 
quickly then fill all of the available 'empty flash with a noin-FF 
value, just to consume time.

Al

augusto einsfeldt wrote:

>Joerg,
>I assume you already did that but I would check what compiler options are on
>or off. Look at  "Project/Options".
>
>-Augusto
>
>
>-----Original Message-----
>From: Joerg Schulze-Clewing [mailto:joergsch@joer...] 
>Sent: Thursday, February 17, 2005 7:32 PM
>To: msp430@msp4...
>Subject: [msp430] Frustrations with Kickstart
>
>
>
>
>Hello All,
>
>Here I am, a hardware guy whose uC exposure has pretty much been C51 and
>very little firmware. So, I loaded the latest IAR Kickstart, got the TI USB
>programmer and soldered together a board with an Olimex F1232 header on
>there. The 32kHz oscillator runs and all but here is where it gets
>frustrating.
>
>Even flashing an LED on P1.0 using the FET_example work space won't do it. I
>mean, this is stuff that was supposed to be a 100% sober evaluation project.
>I'd think. But it produces a plethora of error messages on rebuild, even
>errors in intrinsic.h. What's wrong?
>
>Regards,
>
>Joerg.
>
>
>
>
>
>.
>
> 
>Yahoo! Groups Links
>
>
>
> 
>
>
>
>
>  
>


Reply by augusto einsfeldt February 18, 20052005-02-18

Joerg,
I assume you already did that but I would check what compiler options are on
or off. Look at  "Project/Options".

-Augusto


-----Original Message-----
From: Joerg Schulze-Clewing [mailto:joergsch@joer...] 
Sent: Thursday, February 17, 2005 7:32 PM
To: msp430@msp4...
Subject: [msp430] Frustrations with Kickstart




Hello All,

Here I am, a hardware guy whose uC exposure has pretty much been C51 and
very little firmware. So, I loaded the latest IAR Kickstart, got the TI USB
programmer and soldered together a board with an Olimex F1232 header on
there. The 32kHz oscillator runs and all but here is where it gets
frustrating.

Even flashing an LED on P1.0 using the FET_example work space won't do it. I
mean, this is stuff that was supposed to be a 100% sober evaluation project.
I'd think. But it produces a plethora of error messages on rebuild, even
errors in intrinsic.h. What's wrong?

Regards,

Joerg.





.

 
Yahoo! Groups Links



 




-- 
Internal Virus Database is out-of-date.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.8.7 - Release Date: 10/2/2005
 


Reply by Dieter Teuchert February 18, 20052005-02-18

Hi,

please have a look at your project options. That is a huge dialog with 
about 10 tabbed pages full of options. Take some time and adjust 
everything on one page after the other. Use the help file and the PDF 
documentation files to learn what each option means.

Then it will work and you will take a big step on your MSP430 learning 
curve.

Regards,
Dieter Teuchert

Joerg Schulze-Clewing wrote:

>Hello All,
>
>Here I am, a hardware guy whose uC exposure has pretty much been C51
>and very little firmware. So, I loaded the latest IAR Kickstart, got
>the TI USB programmer and soldered together a board with an Olimex
>F1232 header on there. The 32kHz oscillator runs and all but here is
>where it gets frustrating.
>
>Even flashing an LED on P1.0 using the FET_example work space won't do
>it. I mean, this is stuff that was supposed to be a 100% sober
>evaluation project. I'd think. But it produces a plethora of error
>messages on rebuild, even errors in intrinsic.h. What's wrong?
>
>Regards,
>
>Joerg.
>
>
>
>
>
>.
>
> 
>Yahoo! Groups Links
>
>
>
> 
>
>
>
>
>  
>

Reply by Joerg Schulze-Clewing February 18, 20052005-02-18

Hello Micah,

> 
> It depends, what are the errors? 

For example these:


Error[Pe077]: this declaration has no storage class or type specifier
C:Application SoftwareElectricIAR430INCmsp430x12x.h 1 

Error[Pe065]: expected a ";" C:Application
SoftwareElectricIAR430INCmsp430x12x.h 3 

Error[Pe010]: "#" not expected here C:Application
SoftwareElectricIAR430INCmsp430x12x.h 14 

Warning[Pe012]: parsing restarts here after previous syntax error
C:Application SoftwareElectricIAR430INCintrinsics.h 21 

Error[Pe020]: identifier "istate_t" is undefined C:Application
SoftwareElectricIAR430INCintrinsics.h 32 

Error[Pe092]: identifier-list parameters may only be used in a
function definition C:Application
SoftwareElectricIAR430INCintrinsics.h 33 

This work space was verbatim out of the fet_projects. Just loading and
build produces the errors.

Regards,

Joerg.




Reply by Joerg Schulze-Clewing February 18, 20052005-02-18

Hello Augusto,

> I assume you already did that but I would check
what compiler
options are on
> or off. Look at  "Project/Options".

Yes, I did. I tried to be diligent and also tested several target
devices. Same thing. If I could just find a simple example app for the
F1232 on the web that the IAR compiler "likes" that would get me
started (hopefully...).

This was so much easier in the DOS days. One other weird thing about
this Kickstart environment: If I want to, say, delete a header file
and use another there is a "remove" option but it doesn't remove the
file. I wish they'd at least stick to the ways a "normal" Windows
program operates.

Regards,

Joerg.




Reply by Joerg Schulze-Clewing February 18, 20052005-02-18

Hello Dieter,

> please have a look at your project options. That
is a huge dialog with 
> about 10 tabbed pages full of options. Take some time and adjust 
> everything on one page after the other. Use the help file and the PDF 
> documentation files to learn what each option means.

I did that over and over again but no results. I do need to study the
docs again though because it seems that the Kickstart environment
behaves very differently from any other Windows program I have ever used.

What surprised me was that even example files they included do not
build. That I never had before. With other programs such as Spice or
Microsoft-C all the examples worked flawlessly even if a new and
uninitiated user just calls them up and runs them. The minute you make
your first change that can result in errors but then the learning
process starts.

> 
> Then it will work and you will take a big step on your MSP430 learning 
> curve.

I'll keep trying. Unless there is a stable DOS environment for the
MSP...;-)

Regards,

Joerg.




Reply by augusto einsfeldt February 18, 20052005-02-18

Hi Joerg,
Yes, I have found this same behavior very frustrating. If you were doing an
assembler design I could be more helpfull since I already have a kind of
"first steps" to start a design on IAR.
Another thing: design's file (the one that holds all design information)
usually holds the whole original path for every file and it may led the
compiler to read wrong files if it was created in another environment. 
Also, IAR installation may not set everything right. 
In the ASM case, at XLINK options tab, the XCL file name allways beguns
pointing to a wrong place and for every new design I have to override the
default and direct it to point the correct file. In your case I believe it
should point to MSP430F1232C.XCL. Take a look on this.

Good luck,

Augusto



-----Original Message-----
From: Joerg Schulze-Clewing [mailto:joergsch@joer...] 
Sent: Friday, February 18, 2005 4:41 PM
To: msp430@msp4...
Subject: [msp430] Re: Frustrations with Kickstart




Hello Augusto,

> I assume you already did that but I would check
what compiler
options are on
> or off. Look at  "Project/Options".

Yes, I did. I tried to be diligent and also tested several target devices.
Same thing. If I could just find a simple example app for the F1232 on the
web that the IAR compiler "likes" that would get me started
(hopefully...).

This was so much easier in the DOS days. One other weird thing about this
Kickstart environment: If I want to, say, delete a header file and use
another there is a "remove" option but it doesn't remove the file. I
wish
they'd at least stick to the ways a "normal" Windows program operates.

Regards,

Joerg.





.

 
Yahoo! Groups Links



 




-- 
Internal Virus Database is out-of-date.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.8.7 - Release Date: 10/2/2005
 


Reply by Micah Stevens February 18, 20052005-02-18

Hi Joerg,

Not that it's any consolation, but things build fine for me, even the example 
code. For example, I just tested this one in the simulator, and it builds 
fine. Perhaps try it? (attached)

-Micah



On Friday 18 February 2005 11:54 am, Joerg
Schulze-Clewing wrote:
>  Hello Dieter,
>
>  > please have a look at your project options. That is a huge dialog
with
>  > about 10 tabbed pages full of options. Take some time and adjust
>  > everything on one page after the other. Use the help file and the PDF
>  > documentation files to learn what each option means.
>
>  I did that over and over again but no results. I do need to study the
>  docs again though because it seems that the Kickstart environment
>  behaves very differently from any other Windows program I have ever used.
>
>  What surprised me was that even example files they included do not
>  build. That I never had before. With other programs such as Spice or
>  Microsoft-C all the examples worked flawlessly even if a new and
>  uninitiated user just calls them up and runs them. The minute you make
>  your first change that can result in errors but then the learning
>  process starts.
>
>  > Then it will work and you will take a big step on your MSP430
learning
>  > curve.
>
>  I'll keep trying. Unless there is a stable DOS environment for the
>  MSP...;-)
>
>  Regards,
>
>  Joerg.
>
>
>
>
>
>  .
>
>
>
>
>
>  .





Понравилась статья? Поделить с друзьями:
  • Warning no address error 126 wolfenstein ii the new colossus
  • Warning net game center cannot recover from an error
  • Warning net error monitor
  • Warhammer 40000 dawn of war 2 ошибка xlive dll
  • Warhammer 40000 dawn of war 2 retribution ошибка при запуске