I have gone through most of the files and libraries in code warrior 10.xxx and I can not find a function that will allow me to change the default device MAC address. Has anyone done this?
I don't think the MAC is the compiler's problem.
From the hardware's point of view, the MAC is whatever the software loads into PALR and PAUR.
That is usually handled by the Platform Driver in conjunction with the Ethernet Driver.
Which depends on whatever you're using as an Operating System. Are you using MQX?
The MAC has to be different for each device manufactured, and historically this has been achieved with an EEPROM of some sort. With later chips like the i.MX series, there are "fuses" in the CPU itself that are burned as part of product manufacture with a unique MAC. The MCF52259 has internal FLASH, so the MAC would normally be assigned by the whatever software it in charge of your "production line" and it probably burns the MAC as part of the Bootstrap or Application code.
The problem of getting from the "Example Code" provided by CW to being "Production Ready" is always difficult.
Maybe you should ask this question (or move this thread if you can do that) to a Forum specific to CW or your OS.
Search all the code you're using for "PALR" and "PAUR" as well if you need to reverse-engineer it.
Tom as far as I know we are using MQX.
I will look into where it gets loaded.
Thank you Tom for your reply.
You should search the MQX forum with keywords like "change default MAC". I found this which might get you started:
It is common, at least in Linux setups to have a separate Bootstrap responsible for getting a unique MAC (from somewhere, either from EEPROM, a FLASH partition or burned in as part of the Boot). The Bootstrap can support network operations (it can load the kernel from TFTP for instance) so it initialises the Ethernet hardware and loads the MAC into it.
When the OS Kernel starts, the Ethernet driver reads the MAC back out of the Ethernet Controller, assuming that the boot has already programmed it.
MQX may do that, or may have a configuration option to do that. Even if it doesn't, it may assume that some of your code has done that. Or it may assume that something has already initialised a global with the MAC, or provided a function to get this information.
Some devices generate the MAC from a separately stored Serial Number, although there are reasons why this isn't a good idea.
You'll have to find what MQX expects, and then should work with it rather than trying to work around it.
I've never used MQX, but a quick serch of NXP's MQX pages finds me the following document, and this part seems to be a good place to start:
Freescale MQX™ RTOS RTCS User's Guide (IPv4 and IPv6), Rev. 2, 04/2015
There are lots of examples in the manual showing calls to:
But that function isn't documented anywhere. It may be one that pulls the MAC out of the physical chip, assuming something else has put it there.
Retrieving data ...