Hallo,
I had errors compiling fsl_enet.c. So I had a closer look. The errors came from using math.h.
Please check this below:
Pow(2,y) should be the same like 2<<y //Maybe you could check some boarders.
If that is the same please use shifting registers as this is embedded stuff.
Here is the code change. Math.h would not be used at all in fsl_enet.c.
// txFifoSize = (uint32_t)pow(
// (double)2, (double)(uint32_t)(((base->MAC_HW_FEAT[1] & ENET_MAC_HW_FEAT_TXFIFOSIZE_MASK) >> ENET_MAC_HW_FEAT_TXFIFOSIZE_SHIFT) +
// 7U));
txFifoSize = (uint32_t)(2<<(uint32_t)(((base->MAC_HW_FEAT[1] & ENET_MAC_HW_FEAT_TXFIFOSIZE_MASK) >> ENET_MAC_HW_FEAT_TXFIFOSIZE_SHIFT) +
7U));Best wishes,
Marcus
Hi,
As an alternative, I suppose that you can use the following code to figure out the Fifo size:
txFifoSize =1<<[(base->MAC_HW_FEAT[1])& ENET_MAC_HW_FEAT_TXFIFOSIZE_MASK) >> ENET_MAC_HW_FEAT_TXFIFOSIZE_SHIFT)]-7;
Pls check if it is correct.
Hope it is helpful
BR
XiangJun Rong
Hi Rong,
you are right but +7 as before and cast uint32_t to be sure :-).
txFifoSize = (uint32_t)(1<<(uint32_t)(((base->MAC_HW_FEAT[1] & ENET_MAC_HW_FEAT_TXFIFOSIZE_MASK) >> ENET_MAC_HW_FEAT_TXFIFOSIZE_SHIFT) + 7U));
Marcus
Hi,
I have tried to use the code, it appears it is okay to use the pow(double,double); I can pass the compilation.
#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
#include "board.h"
#include "peripherals.h"
#include "pin_mux.h"
#include "clock_config.h"
#include "LPC54628.h"
#include "fsl_debug_console.h"
#include "math.h"
uint32_t i;
/* TODO: insert other include files here. */
/* TODO: insert other definitions and declarations here. */
/*
* @brief Application entry point.
*/
double dfa,dfb,dfc;
int main(void)
{
// float dfa,dfa,dfc;
/* Init board hardware. */
BOARD_InitBootPins();
BOARD_InitBootClocks();
BOARD_InitBootPeripherals();
#ifndef BOARD_INIT_DEBUG_CONSOLE_PERIPHERAL
/* Init FSL debug console. */
BOARD_InitDebugConsole();
#endif
PRINTF("Hello World\n");
dfa=10;
dfb=4;
dfc=pow(10,2);
dfc=pow(dfa,dfb);
/* Force the counter to be placed into memory. */
volatile static int i = 0 ;
/* Enter an infinite loop, just incrementing a counter. */
while(1) {
i++ ;
/* 'Dummy' NOP to allow source level single stepping of
tight while() loop */
__asm volatile ("nop");
}
return 0 ;
}
Hope it can help you
BR
XiangJun Rong
Hi Rong,
The pow function does not need to be inluded with libm option. But if I use libm parameter this use of pow gives an error.
Please provide an example to use the pow function with the library libm parameter.
Another way is to check if the use of the pow function is really necessary. This would I prefer.
Wishes,
Marcus